Re: [julia-users] C interop: pointer to elementary julia type

2015-09-01 Thread Jameson Nash
use `Ref{Clong}` for the calling convention to pass an auto-allocated boxed c-long. it's usually best to avoid `pointer` and `pointer_from_objref`. memory is not "guaranteed by julia": it will be cleaned up as soon as the gc detects that you are no longer referencing the julia object. using

Re: [julia-users] C interop: pointer to elementary julia type

2015-09-01 Thread Joosep Pata
Thanks Jameson, I want to later use `x` in auto-generated expressions, and if it's a Ref I will have to use `x.x` to get the actual data which makes generating the expressions more tricky, I thought I could perhaps avoid it. Here's a more complete snippet: ~~~ type Foo x::Int64

Re: [julia-users] C interop: pointer to elementary julia type

2015-09-01 Thread Jameson Nash
I still have no idea what you are trying to do, but punning on types like your example shows is going to get you in deep trouble with both Julia and C. (using Expr and quoted ASTs will also cause you issues, but for completely different reasons). ``` type Foo x::Clong y::Vector{Clong} end