It seems to me like the error message is correct. The first argument to 
ccall must be constant, and it looks like you have a variable called `path` 
in your ccall.

Can you try to declare path as const, or just put the library name/path as 
a string/symbol in the ccall expression.

Ivar


kl. 20:10:32 UTC+1 mandag 10. mars 2014 skrev Patrick Foley følgende:
>
> 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