Distutils and MinGW with C++

Andrew Gregory andrew.gregory at npl.co.uk
Sat Dec 14 12:30:17 EST 2002


Problem solved. In order to compile C++ Python extensions with MingW
using distutils you need to link to libstdc++.a (supplied with MingW).
The setup.py file is:

# setup.py - for building _pysimple.pyd
#
# To use, from command line type:
#   python setup.py build --compiler=mingw32

from distutils.core import setup, Extension
setup (name = "_pysimple",
       version = "1.0",
       maintainer = "Andrew Gregory",
       maintainer_email = "andrew.gregory at npl.co.uk",
       description = "Sample Python DLL",
       ext_modules = [Extension('_pysimple',
                      library_dirs=['C:\\mingw\\lib'],
                      libraries=['stdc++'],
                      sources=['pysimple_wrap.cxx'])])



More information about the Python-list mailing list