[Pyrex] sharing funcitons with distutils for .pyx

Jim Kleckner jek-gmane at kleckner.net
Wed Sep 19 07:59:49 CEST 2007


The documentation says to add libraries in distutils
for extensions with a "libraries" clause as in:
     distutils.extension.Extension("pack1.mod2", ["mod2.pyx", ], 
libraries=['mod1',], ),

I have a .pyx file that depends on functions defined in a .c
file that is included with another .pyx, say it is "cfunc1" defined in 
cfuncs.c

=======
     ext_modules = [
         distutils.extension.Extension("pack1.mod1", ["mod1.pyx", 
"cfuncs.c", ]),
         distutils.extension.Extension("pack1.mod2", ["mod2.pyx", ], 
libraries=['mod1',], ),
     ],
=======

If I don't include "libraries=['mod1',]" then I get an undefined 
reference to cfunc1 when linking mod2.dll.

If I include the 'mod1' library, then the linker gets -lmod1
which looks for libmod1.dll which isn't there (it is called mod1.dll).

Is there some little trick to sharing functions between pyx extensions?
I'm sure I'm missing something simple.

Thanks - Jim





More information about the Pyrex mailing list