Compiling and Linking pre-built Windows Python libraries with C++ files on Linux for Windows

Ankit Agarwal ankit at applied.co
Fri Mar 18 20:08:48 EDT 2022


Hi,

This is a very specific question. I am trying to figure out whether or not
I can use pre-built python libraries and headers on Windows in a MinGW
build on Linux. Essentially I have some python and C++ code which interface
via cython and pybind. I want to build a self contained C++ binary for
Windows with the MinGW compiler that runs on Linux. For both Cython and
PyBind, they need to compile with the python headers and link against the
python DLL in order to run on Windows.

I know that the python DLL specifically are compiled with the MSVC
compiler, however since it is in C, the ABI between the DLL should be
compatible with MinGW, and I should be able to import and link against it.
My question is will this work, or will there be some other problem that I
might run into.

I am using python 3.7 by the way for this.

Let me know what you think,

Thanks :)

Ankit

*Ankit Agarwal*

Software Engineer

ankit at applied.co

+1 630.506.4914

Applied Intuition, Inc. <https://applied.co>
blog.applied.co


More information about the Python-list mailing list