[Pyrex] Dynamic wrapping of external C libraries?
Jim Kleckner
jek-gmane at kleckner.net
Sat Oct 27 09:17:47 CEST 2007
Greg Ewing wrote:
> 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.
By the way, it occurs to me that implementing this mechanism
would be an express train for wrapping static libraries
and making the available to Python... It would put that
aspect of Pyrex on a par with SWIG which can parse the
C code to generate the interface directly.
In fact, you could coax SWIG to provide a Pyrex back end
to generate the .pxd files...
More information about the Pyrex
mailing list