I'm trying to call the C interface to the HSL MA97 from Julia. It's a 
symmetric indefinite factorization library that uses OpenMP. One of the 
main C functions expects a void** as argument. The example that ships with 
the library declares a void* variable named akeep. The main program doesn't 
do anything with it except that it passes &akeep (i.e., a void**) to some 
of the library functions. Presumably, those functions allocate memory 
pointed to by akeep. It's a bit perplexing, but that's how it is. At the 
end, there's a call of the form free(&akeep).

My question is: what syntax should I use in Julia to perform the same 
operations? Naively, I'm tempted to try something like

akeep = Ptr{Void}
ccall((:some_function, "libwhatever"), Void, (Ptr{Void},), akeep)

but that returns the error message: `convert` has no method matching 
convert(::Type{Ptr{None}}, ::Type{Ptr{None}}).

Replacing akeep with &akeep in the ccall returns: expected Ptr{None}, got 
Type{Ptr{None}}.

What might be the appropriate syntax here? And more importantly, is this a 
recipe for a segfault?'

This is with Julia 0.3.11.

Thanks!

Reply via email to