I have changed the function to now be 
"extern double bessela1(double x) { "

Everything still compiles nicely, but I get the same error.  

- Patrick


On Monday, March 10, 2014 2:45:12 PM UTC-4, Patrick Foley wrote:
>
> Hi All,
>
> I wrote some C code to compute a ratio of bessel functions, and am now 
> trying to access it with Julia.  I have compiled it into a shared library 
> with 
>
> "gcc -std=c99 -fPIC -shared -lm bessela1.c -o bessela1.so".
>
> This compiles without any errors or warnings, and the code works.  
>
>
> I'm trying to use a function 
> '''
>
> double bessela1(double x) {
>
> // lots of code.
>
> return y;
>
> }
> ''' defined within the bessela1.c file.  All functions it needs are also 
> in the .c file, and I don't use any other files.    
>
> So in my Julia code, I have 
>
> s = ccall( (:bessela1, path), Float64, (Float64, ), 0.5)
> and path is the path to the bessela1.so file.  
>
> When I run this in julia, I get the following error:
>
> ERROR: type: anonymous: in ccall: first argument not a pointer or valid 
> constant expression, expected DataType, got Type{(Any...,)}
>
>  in anonymous at no file
>
>
> I believe that the C code is compiling correctly (I know it works in C), 
> and I can run dlopen() on the .so file and get a pointer back, but I'm not 
> sure what to do with that.  
>
> Can anyone point out what I'm doing incorrectly?  I've also tried using 
> "bessela1" rather than :bessela1, but get the same error.  
>
> Thanks,
> Patrick
>

Reply via email to