[C++-sig] BPL, Mingw g++, and MSVC Python

David Abrahams david.abrahams at rcn.com
Tue May 28 21:22:06 CEST 2002


----- Original Message -----
From: "John Barnard" <barnard at stat.harvard.edu>


> I'm trying to determine if it's possible to do the following under MS
> Windows 2000:
>
> (1) Compile a C++ class file into a DLL using Mingw g++ 2.95.3 or 3.1;
>
> (2) Create a Python interface to the class using Boost.Python v2, again
> using Mingw g++ 2.95.3 or 3.1
>
> (3) Call the Python interface DLL from a MSVC++ compiled Python 2.2.
>
> I'm mainly confused about the ability of a g++ compiled Python extension
> to use g++ compiled DLLs (created from C++ source) when using a MSVC++
> compiled version of Python. Given that only the DLL version of BPL is
> being supported, if my above scenario can't be done, does that imply
> you can't create wrappers to C++ code via BPL with g++ and use them with
> MSVC++ compiled Python?
>
> I've done this in the past with a static lib of Boost.Python v1 but I
> would like to use v2.

I don't see any reason this should be a problem. The only limitations are
that

1. bpl.dll must be compiled with the same compiler as the extension module
and your "class DLL" (or one with a compatible C++ ABI, c.f. intel/msvc)

2. The compiler used to build Python must have a 'C' ABI which is
compatible with that of the compilers used for the DLLs. As far as I know,
all Windows compilers have compatible 'C' ABIs. I regularly test
MINGW-compiled extensions and bpl.dll with an MSVC6-compiled Python.

-Dave







More information about the Cplusplus-sig mailing list