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

Gustavo Sverzut Barbieri barbieri at gmail.com
Sat Sep 15 02:37:37 CEST 2007


On 9/14/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 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.

It would be great.

Right now I do "include 'file.pyx'", but it sucks due lack of
dependency tracking and I have to "touch main.pyx" to get it rebuilt.


-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri at gmail.com
   MSN: barbieri at gmail.com
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010



More information about the Pyrex mailing list