Are you sure this works? I followed every step for making a DLL as you had described, but I get a lot of warnings and errors. I am using Boost 1.35.0 with Visual C++ 9.0. Here is the first batch of warnings leading to the first error: 1>------ Rebuild All started: Project: getting_started2, Configuration: Debug Win32 ------ 1>Deleting intermediate and output files for project 'getting_started2', configuration 'Debug|Win32' 1>Compiling... 1>stdafx.cpp 1>Compiling... 1>getting_started2.cpp 1>dllmain.cpp 1>dict.cpp 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(30) : warning C4273: 'boost::python::detail::dict_base::call' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(77) : see previous definition of 'call' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(37) : warning C4273: 'boost::python::detail::dict_base::dict_base' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(72) : see previous definition of '{ctor}' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(41) : warning C4273: 'boost::python::detail::dict_base::dict_base' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(73) : see previous definition of '{ctor}' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(45) : warning C4273: 'boost::python::detail::dict_base::clear' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(24) : see previous definition of 'clear' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(53) : warning C4273: 'boost::python::detail::dict_base::copy' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(27) : see previous definition of 'copy' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(68) : warning C4273: 'boost::python::detail::dict_base::get' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(30) : see previous definition of 'get' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(81) : warning C4273: 'boost::python::detail::dict_base::get' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(32) : see previous definition of 'get' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(86) : warning C4273: 'boost::python::detail::dict_base::has_key' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(35) : see previous definition of 'has_key' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(91) : warning C4273: 'boost::python::detail::dict_base::items' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(38) : see previous definition of 'items' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(104) : warning C4273: 'boost::python::detail::dict_base::iteritems' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(41) : see previous definition of 'iteritems' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(109) : warning C4273: 'boost::python::detail::dict_base::iterkeys' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(44) : see previous definition of 'iterkeys' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(114) : warning C4273: 'boost::python::detail::dict_base::itervalues' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(47) : see previous definition of 'itervalues' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(119) : warning C4273: 'boost::python::detail::dict_base::keys' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(50) : see previous definition of 'keys' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(132) : warning C4273: 'boost::python::detail::dict_base::popitem' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(54) : see previous definition of 'popitem' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(139) : warning C4273: 'boost::python::detail::dict_base::setdefault' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(57) : see previous definition of 'setdefault' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(144) : warning C4273: 'boost::python::detail::dict_base::setdefault' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(59) : see previous definition of 'setdefault' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(149) : warning C4273: 'boost::python::detail::dict_base::update' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(62) : see previous definition of 'update' 1>c:\program files\boost\boost_1_35_0\libs\python\src\dict.cpp(162) : warning C4273: 'boost::python::detail::dict_base::values' : inconsistent dll linkage 1> c:\program files\boost\boost_1_35_0\boost\python\dict.hpp(65) : see previous definition of 'values' 1>errors.cpp 1>exec.cpp 1>c:\program files\boost\boost_1_35_0\libs\python\src\exec.cpp(17) : error C2491: 'boost::python::eval' : definition of dllimport function not allowed gchen wrote:
happybrowndog wrote:
Is there a way to build a boost python extension using Visual C++ IDE instead of bjam? Has anyone done it, and how is it done?
I use VS project to build all boost libraries which are not head-only.
For Boost.Python:
First create a static library (.lib) or dynamic library (.dll) VS project, add all the .cpp files in 'boost\libs\python\src' to it.
Then open the project properties dialog, add boost and Python include path in 'C++ -> General', if you choose a static library (.lib), add a BOOST_PYTHON_STATIC_LIB in 'C++ -> Preprocessor', if you want choose the output library name, add a BOOST_PYTHON_NO_LIB too, if it is a dynamic library (.dll), add the Python lib in 'Linker -> Input'.
You can get the details about these BOOST_PYTHON_XXXX preprocessors in boost\python\detail\config.hpp.