Ok, I originally badly screwed up my formulation of this question (it's more than a year now since I seriously wrote C++ code and I have pretty limited experience with pure C), so let's try again.
Some C code is written to expect you to do something like the following
void* p;
create_new_thing(&p); //p is now a new thing
do_stuff_to_thing(p); //something happened to p
My question is how to create the object p
in Julia. Right now I believe the answer to be
p = Ref{Ptr{Void}}()
ccall((:create_new_thing, :lib), Void, (Ptr{Ptr{Void}},), p)
ccall((:do_stuff_to_thing, :lib), Void, (Ptr{Void},), p)
Furthermore, I believe the same code but with p
declared instead as p = Array(Ptr{Void}, 1)
also works.
I do however find the whole distinction between Ref
and Ptr
in Julia very confusing, mostly because they seem to get converted between each other in ways I cannot keep track of.