Cython - properly declaring C funs

Posted by deepblue on Stack Overflow See other posts from Stack Overflow or by deepblue
Published on 2011-01-12T01:34:16Z Indexed on 2011/01/12 1:54 UTC
Read the original article Hit count: 543

Filed under:
|

I'm having trouble with running a bare example.

I'm using this to declare a function in Cython coming from cinterf.h header:

cdef extern from 'cinterf.h':  
int xsb_init_string(char* p_xsb_path)

The declaration in the C header file is:

DllExport extern int call_conv xsb_init_string(char *);

both DllExport and call_conv are macros defined elsewhere, and resolve to GCC compiler directives.
do I have to use those as well inside cdef to fully match the declaration?

When I call xsb_init_string() as:

xsb_init_string('some string')

The python interpreter gives me:

'ImportError: ./py_ext.so: undefined symbol: xsb_init_string'

Am I declaring the xsb_init_string() signature properly, inside cdef?

© Stack Overflow or respective owner

Related posts about c

    Related posts about cython