On Thursday, January 8, 2015 11:00:58 AM UTC-5, Andreas Lobinger wrote: > > Looks interesting. But what do i pass with ccall(:flip, Void, (mytype,), > t)? >
That syntax means that you are attempting to pass mytype as a struct by value, which currently does not work reliably due to ABI issues. If you want to pass the internal Julia pointer to the type (the jl_value_t* in the Julia API), it is possible: you can do ccall(:flip, Void, (Any,), t), but this is almost never a good idea unless you really know what you are doing. It is *not* equivalent to a pointer to the C struct of your type, because it is instead a pointer to the Julia data structure "boxing" the type. (However, this may change; see: https://github.com/JuliaLang/julia/pull/2818) > When to use Ptr{Void} and when Ptr{mytype}? > As far as C is concerned, all pointer types are created equal. But use Ptr{mytype} if you want Julia to automatically do the right thing for &t. If you use Ptr{Void}, then you may need to do some manual pointer casts in Julia to tell it what conversion you want.
