Hi,

I've encountered a problem with cimport and public function
declarations. The situation is the following:

I've got one Cython module with this definition file (gui.pxd):

include "ctypes.pxi"
include "plugin.pxi"

cdef public void plug_observ_data(plugDefinition *p, const_char_ptr id)

Another module (loader.pyx) needs this function, so I tried this cimport:

from ship.icewing.gui cimport plug_observ_data

Cython compiles this without errors, but the resulting C code is wrong.
loader.c now contains this definition:

/* Declarations from ship.icewing.gui */

DL_EXPORT(void) (*plug_observ_data)(plugDefinition *, const char*);
/*proto*/

As you can see it declares this function to return a pointer, which
isn't the case. gui.h (also generated by Cython because of the public
definition) declares it like this:

__PYX_EXTERN_C DL_IMPORT(void) plug_observ_data(plugDefinition *, const
char*);

So the c compiler reports an error because of the diverging definitions.
This only happens with the public declaration of plug_observ_data. With
put the "public" modifier everything works.

Am I doing something wrong or is this behavior a bug?

Johannes

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to