I try to embed Julia as explained in the documentation (https://docs.julialang.org/en/v1/manual/embedding/index.html) but can not manage to get it working with chars. I must probably be missing something basic.
When I run the following code
jl_function_t *func = jl_get_function(jl_base_module, "uppercase");
char const *julia = "julia";
jl_value_t *argument = jl_box_char(*julia);
jl_value_t *ret = jl_call1(func, argument);
const char *unboxed = jl_string_ptr(ret);
// expecting "JULIA", getting an empty string
the variable unboxed is returned empty. jl_box_char seems to expect a pointer since its argument must an uint32_t (https://github.com/JuliaLang/julia/blob/24f1316e91de029f71f636db23aced49156b44ad/src/julia.h#L1182).
Note that chars are correctly unboxed when calling:
jl_value_t *ret = jl_eval_string("uppercase(\"julia\")");
const char *unboxed = jl_string_ptr(ret);
Any idea? Thanks.