[Pyrex] compiling more .pyx and .pxd files into one .so

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Sep 15 00:50:07 CEST 2007


Stefano Esposito wrote:
> Is it possible to write several pyx and pxd files and have 'em
 > compiled into an unique shared object?

It ought to be possible, but would need a bit of hacking.
One possibility that comes to mind is to choose one of the
.pyx files to be the "main" one that you import from Python,
and put explicit calls to the module initialisation functions
of the other modules in it. Then link all the .o files together
into a single shared object named after the main module.

I'm not sure whether you could do this with distutils --
you might need to use a makefile or some such to do the
compiling and linking.

I may add support for this kind of thing to Pyrex at some
point.



More information about the Pyrex mailing list