Hi,

I can't seem to get a hang of how to call a C function that essentially 
needs a string containing the path to a file as input, but it is declared 
as a structure containing a const char. The setup is the following (SPICE 
library):

I want to call the function:

void furnsh_c ( ConstSpiceChar  * file )  { ... }

with the structure ConstSpiceChar being defined as:

typedef const char     ConstSpiceChar;

I don't know how to call that from Julia. What I have tried and modified in 
many ways is the following:

immutable ConstSpiceChar
    x::Ptr{UInt8}
end

kernel = ConstSpiceChar(pointer("../../../../cspice/kernels/sat317.bsp"))

ccall((:furnsh_c , spicelib), Void, (Ptr{ConstSpiceChar},) , pointer(kernel
))

Which ends up in an error:

LoadError: TypeError: anonymous: in ccall: first argument not a pointer or 
valid constant expression, expected Ptr{T}, got Tuple{Symbol,ASCIIString}

I hope there is an easy solution to this. I am not very skilled in C.

Thanks, Felix.


Reply via email to