Passing a pointer to struct as an argument in Julia -


i have type definition corresponding c-struct follows:

type fakecstruct   a::uint8;   b::uint32; end var=fakecstruct(3,4); 

how can pass pointer type input argument (i.e. struct cstruct *) c-function in ccall?

the old documentation (v0.3) suggest using &var in input argument list of ccall. statement deleted in v0.4 documentation (also, &var not work in v0.4).

use ref{fakecstruct}:

r = ref(fakecstruct(3, 4)) ccall((:somefunction, "lib"), void, (ref{fakecstruct},), r) 

from julia docs in system independent table here:

c name:                                                   |   julia base type t* (where t represents appropriately defined type)     |     ref{t} 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -