If you are trying to pass a struct by-value then it is unlikely to work.
Julia does not support this at the abi level as yet. I think there is an
open issue about this, and an old PR.

For more readable code_llvm output, try setting 'f(args) = ccall(...)' and
look at code_llvm for f. Another way to see the details is to use a
debugger and set a breakpoint in the function you are calling.
On Jan 8, 2015 4:29 AM, "Andreas Lobinger" <[email protected]> wrote:

> Hello colleagues,
>
> i thought i understood the ccall interface but now i ran into a problem
> (segmentation fault) and i cannot really track down, where actually the
> problem occures.
> I want/need to pass a pointer to structure (c style) to a library and the
> function in the library writes entries in the structure.
>
> (the following i write from memory, i do not have the code on this
> computer...)
>
> type mytype
>     a::Int32
>     b::Int32
> end
>
> t = mytype(0,0)
>
> ccall(:flip, Void, (mytype,), t)
>
>
> 1) is there somewhere code you would recommend to read?
> 2) how can i use code_lowered or code_llvm to actually see the details.
> The above example is included in a module and it looks like the code is
> compiled at 'using' so code_llvm e.g. only shows the call to the compiled
> function, but not the inside.
> 3) other documentation (blog, FR) etc?
>
> Wishing a happy day,
>       Andreas
>

Reply via email to