Boost logo

Boost Users :

Subject: [Boost-users] Link Boost::Python statically
From: Marcin Simonides (marcin_at_[hidden])
Date: 2009-02-24 11:48:37


Hello,

I'm trying to link my Python extension module with static version of
Boost::Python library.

According to documentation, the auto_link facility should by default
supply the library for static linking
(libboost_python-vc80-mt-gd-1_38.lib in my case).
Unfortunately it doesn't work that way for me - I get the import lib by
default and have to supply boost_python dll.

If I specifically provide the statically linked lib to the linker I get
errors that symbols are defined multiple times by both the static
library and the import library.

I was able to link statically by:
- defining BOOST_ALL_NO_LIB,
- defining BOOST_PYTHON_STATIC_LIB,
- adding libboost_python-vc80-mt-gd-1_38.lib to link libraries.

While this worked I have a strong feeling that it's not the way it was
meant to be.

I'm using Visual Studio 2005 to compile my project (it's a Win32 DLL
project), I'm using Boost 1.38 that I have compiled with bjam (which
probably isn't relevant). All boost's *.lib files are in the same
directory so they should be all accessible to the linker.
I'm not aware of any BOOST_*_DYN_LINK being set (I have never set any
Boost related defines other than the above. If you have any tips on how
to verify that, I'd be grateful).

Could you help me with this problem? Is there anything I should check
that would cause the DLL to be used by default?

-- 
Marcin Simonides

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net