Why GCC-compiled Python libraries compatible across compiler versions while MSVC ones are not?

366 views Asked by At

I am adding some Python packages (from pip) to a 3rd-party application's Python interpreter on both Linux and Windows. In the Linux release of their application they compiled Python against GCC 4.xx, while in their Windows release they compiled it against MSC 1900.

On Windows I had to build each Python package that has .pyd files with the same MSVC version or else I would get runtime errors when attempting to import them in Python. While on Linux I was able to import Python libraries built with any GCC version in a 4.xx-built interpreter.

Can somebody explain how it works or why the binaries built with different MSVC versions don't work together?

1

There are 1 answers

0
EvgenKo423 On BEST ANSWER

Each Visual Studio version before 2015 had its own version of C Runtime which must be installed separately. In Visual Studio 2015 the Universal CRT has been introduced which is now a part of Windows 10.

Nevertheless, it doesn't mean that libraries using different runtimes are incompatible. The errors you were getting are probably caused by the fact that you simply don't have the corresponding runtime versions installed on your system. Apart from that they should work just fine (except for some special cases).