I thought I could use jl_value_t** instead of double* in this case, but when giving this array to a julia function, I just get random values as the elements (probably because it is interpreting the type information).
But how then, would you manage an Any[] in Julia if there is no type information on each element? Do I need a different approach or is this something that is just not implemented?
The way you allocate the jl_value_t* array is wrong. jl_ptr_to_array_1d(..., true) only accept malloc allocated pointers.
Also, even though your code doesn’t have any other issue yet, you must not mutate arr after you created metadata unless you also trigger the write barrier.