[Pyrex] Dynamic wrapping of external C libraries?

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 27 08:15:47 CEST 2007


Jim Kleckner wrote:
> You would like to link the library functions into the shared
> object of the wrapper pyx and perform the dynamic linkages for
> them.
> 
> Does the api mechanism give you a succinct way of doing this now?

No, you can't do that at the moment. The way to specify
it would probably be

   cdef extern from "somewhere.h":
     api void foo()

but combining 'extern' and 'api' is not currently allowed.
I could look into whether that restriction can be lifted.

Note that you would only ever have to do this if the library
in question were being statically linked. If it's dynamically
linked, any other module that might want to use the API
could just link directly with the library itself.

--
Greg




More information about the Pyrex mailing list