Question

Having trouble compiling a Python extension under Windows, I've asked a question.One of the answers does not answer my question but is worth asking as a question on its own.

Given a Visual C++ compiled Python distribution under Windows, would I have any problems if I use Visual C++ compiled extensions along with MinGW compiled ones?

This would allow me resort to MinGW when it is easier than configuring MS compiler.

Was it helpful?

Solution

It's not officially supported, but I think it should work. Python exposes extern "C" functions (with C linkage), so you should be able to call them from MSVC. But that's only Python itself. What about extensions? PyMODINIT_FUNC also has extern "C" in it, so that allows to call it from MSVC, too. Functions that you pass to Python by function pointer should also work, because they use cdecl calling convention by default, but do not need C linkage (or C name mangling) because they are called by pointer. To sum up, it should Just Work™.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top