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

Gustavo Sverzut Barbieri barbieri at gmail.com
Sat Sep 15 16:17:30 CEST 2007


On 9/15/07, Alexander Belchenko <bialix at ukr.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Gustavo Sverzut Barbieri пишет:
> > 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.
>
> Much worse is namespace pollution that you have in this case.

Why?

I just split this file into multiple because the library is quite big,
but it's the same library. I have different functions for functions,
others for main objects and others to provide "cdef" callbacks to be
used by these objects.

Anyway, I'm really open to suggestions, please take a look at my code
(at least the file layout) and see if it can be improved:

   http://staff.get-e.org/?p=e17/proto/python-efl/python-evas.git;a=tree;f=evas;h=52c4b5eb6a9ee5c8dd669311bd3f66ea59947f52;hb=HEAD

It's a module "evas" with a submodule "evas.c_evas"


-- 
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