Notes on Python compiled with MinGW-w64¶
Python.org releases binaries compiled with Microsoft Visual C++ (MSVC) - see Using Microsoft Visual C with Python.
The MSVC runtimes are not compatible one with another. That means, that if Python is compiled with version X of MSVC, then you will have to compile all your extension with that same version X, in order to use the same run-time.
MinGW-w64 links against
MSVCRT.DLL. Quoting from
What is the difference between msvcrt.dll and msvcr80.dll?
The msvcrt.dll is now a “known DLL,” meaning that it is a system component owned and built by Windows. It is intended for future use only by system-level components.
See also MSVCRT notes. MinGW-w64 also has its own
C runtime for functions not available in
In the past, the CPython has resisted supporting MinGW compilation of Python:
thread on Support for MinGW Open Source Compiler;
thread on Reasons not to support MinGW for official Python builds;
a particular issue building extensions for MinGW, with many general comments later in the thread. From that thread, see the summary by Paul Moore reply by Ruben Van Boxem and notes by Nathaniel Smith. For example (Paul Moore – Python packing authority): “My personal view is that if the scientific community comes up with a mingw/gcc toolchain that they are happy with, and willing to support, then I would see that as a reasonable target to be “the” supported mingw toolchain for distutils.”
The MSYS2 project provides patched Python builds (patches for Python 2 and Python 3).