I want to ccall a file which is relative to the packages dir, but
const path = joinpath(@__FILE__,"..","bin","lib.so")
ccall((:fn, path),...)
fails with the same error as above
first argument not a pointer or valid constant expression
How can I fix this?
On Monday, November 30, 2015 at 7:08:09 PM UTC+1, Felix wrote:
>
> 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.
>
>
>