[Pyrex] Problems with 'public' C functions in an extension

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jul 3 09:58:21 UTC 2006


Stefan Behnel wrote:

> Maybe the right solution is to drop the current support completely and make
> public C functions generate a struct with all public function pointers and the
> above header code for external modules.

Yes, I've been thinking of doing something like that to
make it possible to cimport C functions in another Pyrex
module, but C code should be able to use it as well,
given suitable declarations.

BTW, I never really envisaged the 'public' mechanism
being used across dynamically loaded modules, only for
C code statically linked with the module. I wouldn't
be surprised if you just can't do that sort of linking
on some platforms.

On another tack, do you really need to write the code
which is going to use these functions in C rather than
Pyrex? Consider that you can use C methods of an extension
type from another Pyrex module using the existing
cimport mechanism, and that almost any code you could
write in C you could also write in Pyrex.

--
Greg




More information about the Pyrex mailing list