[python-win32] Cython-generated module crashes after importing C++-extension compiled with MinGW

Christoph Groth cwg at falma.de
Tue Apr 30 12:12:25 CEST 2013


Graham Bloice <graham.bloice at trihedral.com> writes:

> Can you mix compilers with Python extensions, I thought you should (must)
> use the same compiler as the version of Python you are using is built with
> due to the compiler run-time library being used?  See
> http://docs.python.org/2.7/extending/windows.html#using-dlls-in-practice

At least with MinGW it works: I've just found a work-around. (Cython is
innocent here.)

The problem appears when an extension compiled with gcc tries to import
(by using Python's __import__) another extension compiled with g++.
Both extensions can be imported from Python individually!

My work-around for now is to compile and link everything with g++.

I will look more into this soon.  Does anyone have an idea why mixing
gcc and g++ has these effects?  It works on other platforms, so the code
is OK.



More information about the python-win32 mailing list