Hello everyone,
I just got started with Julia, and I wanted to try to wrap a C/C++ library
to Julia to check whether it would work out for my purposes.
I tried out many ways of passing arrays and other objects from C back to
Julia.
So far it seems that it takes a lot of extra code if I want
This is a totally reasonable thing to do. You just have to be careful
that objects are rooted across other object allocations; passing julia
objects around as Ptr{Void} hides them from the GC.
If Any is used as the return type of the ccall, the result will be
treated as a julia reference and you
Hi Jeff, thanks for the quick reply.
If Any is used as the return type of the ccall, the result will be
treated as a julia reference and you can skip
unsafe_pointer_to_objref.
If returning Any, would the GC take care of it?
A variant of this is to allocate the array in julia, and pass
To formulate my question a bit more specifically (about the last part of my
email)
Suppose I want to call jl_new_struct() to instantiate a 'type', I need to
provide the type, so I guess
I have to pass the right jl_datatype_t *, which might be found
with jl_get_global().
Now, jl_get_global()