Hi there,
I am currently playing with Julia calls from C. I have made some good
progress insofar as calling Julia functions, boxing/unboxing etc. What I am
particularly interested in however is being able to return a type which
consists of a number of Float64s and being able to get/set their values on
the C side.
For example
type Example
a::Float64
b::Float64
c::Float64
end
Unboxing returns a copy of a value, so no means to then set it and
jl_get_nth_field seems to also do the same.
I am able to get a reference to the value using pointer arithmetic by
getting jl_value_t + 1. I'm assuming the raw jl_value_t pointer is the type
pointer? and offsetting by 1 is the pointer to the value?
Accessing elements in the type seems possible by further offsetting the
pointer jl_value_t + 1 + elementIndex. My question is, is this a safe
assumption to make? Or is there a better way to be doing this that I
haven't spotted yet?
Thanks,
Chris