How to handle an array of structures when embedding Julia in C


#1

Hi!

I have a function that returns an array of a structure. This function is called inside a C++ software using this code:

    jl_value_t *filename  = jl_eval_string("\"amz1.tle\"");
    jl_array_t *array_tle = (jl_array_t*)jl_call1(read_tle, filename);

It is working fine, since jl_(tle) shows all the elements in the Array. My question is, in C++, how can I obtain a pointer to each element of this array in which the type is TLE (a structure define in my package)?

I tried this:

    jl_value_t* tle = (jl_value_t*)jl_array_data(array_tle);

but it gives me a segmentation fault.

I can make it work if data is double, int, etc. However, when the data is a structure, I have no idea how to handle inside C++ when unpacking from an array.