[Python-Dev] distutils win32 multiple extensions

ebacry emmanuel.bacry at polytechnique.fr
Tue Apr 23 12:35:43 CEST 2013


I am writing some C extensions (using swig).
A first extension (a python module) which I'll call E1.
I wrote a setup.py which works fine on all platforms.
On Windows 7 it creates a library which is a .pyd file

Now I want to write a second C extension E2 that is calling some functions
of E1.
The same kind of setup.py works fine on all platforms but Windows where it
says (during the link) that the function sof E1 that are called by E2 are
I am clearly not a Windows pro ... I am using mingw32 on Windows.
Surfing the web, I understood that shared libraries work differently on
windows than on other platforms. And that I should

1- export the symbols (i.e., the functions) of E1 when I build E1. In the
distutils.Extension this seems to be done using 
argument export_symbols=[list of symbols to export]
Now I have one problem : each time I specify in this list the name of a
function in E1 it says that it doesn't know this symbol
What am I doing wrong here, is there a special syntax ?

2- Now in the setup.py of E2 how do I declare that I want to use the E1
shared lib.? Is the information on the exported symbol of E1 in the .pyd
file or in the .def file ?
I tried to specify the .pyd library in the arguments of the
distutils.Extension .... but I have the feeling that's not the right thing
to do (I have the feeling the .pyd is not the right file to point to)
Not mentioning the problem specifying the path of the library with
runtime_library_dirs ... which does not seem to work at all.

Is there a simple way to do what  I want to do ?
I did not find anything on the web explaining clearly what to do ...
I am really really stuck

I would appreciate any kind of help 


View this message in context: http://python.6.x6.nabble.com/distutils-win32-multiple-extensions-tp5015138.html
Sent from the Python - python-dev mailing list archive at Nabble.com.

More information about the Python-Dev mailing list