Published: Oct 13, 2013
python does not define MS_WIN64 for gcc, it defines the one only for visual studio. (see python27/include/pyconfig.h:142
). solution - you have to build boost.python and your modules with -DMS_WIN64 option.
note: I use GOW package, it contains some useful ported from linux programs like cp, mv, etc.
make sure mingw64/bin and python27/bin is in PATH variable
create static python library (if needed):
gendef.exe python27.dll
dlltool.exe --dllname python27.dll --def python27.def --output-lib libpython27.a
mv libpython27.a d:\devtools\python27\libs\
build boost.python:
bootstrap.bat
b2 toolset=gcc address-model=64 variants=debug,release link=static,shared threading=multi define=MS_WIN64 --with-python stage
useful flags for debugging (same for bjam):
b2 -a -q --debug-configuration
b2 -d+2
build test embedding module
cd libs\python\examples\quickstart
..\..\..\..\bjam.exe toolset=gcc address-model=64 define=MS_WIN64 --verbose-test test
build sample library:
g++ -I"d:/devtools/boost_1_54_0/" -I"d:/devtools/python27/include/" -DMS_WIN64 -c wrap.cpp
g++ -shared -o example.pyd wrap.o -L"d:/devtools/boost_1_54_0/stage/lib" -L"d:/devtools/python27/libs" -lboost_python-mgw48-mt-1_54 -lpython27
cp d:/devtools/boost_1_54_0/stage/lib/libboost_python-mgw48-mt-1_54.dll .
python
>>> from example import *
note for static libs use -DBOOST_PYTHON_STATIC_LIB
useful articles:
examples (in russian):
Alexey Vasilyev
Freelance Software Developer, Father, Bread-maker, BBQ-master, Coffee-warrior, Mondays-hater