Configuring Visual Studio to work with Boost.Python and Python 3

こ雲淡風輕ζ 提交于 2019-12-02 01:39:50

With the community help I have found answers to couple of the questions.

  1. Is it possible to influence the logic used by VS to look for Boost.Python library?

Name of library depends on value defined as macro BOOST_LIB_NAME in file boost/python/detail/config.hpp. I have tried to change line (108 in boost 1.64.0)

#define BOOST_LIB_NAME boost_python

to

#define BOOST_LIB_NAME boost_python3

And desirable library file changed from boost_python-vc120-mt-1_64.lib to boost_python3-vc120-mt-1_64.lib.

It should be noted, that instead of changing values in config.hpp file auto_link.hpp can be created and used with redefinition of BOOST_LIB_NAME.

  1. What option in the project properties should make VS2013 to use different LIB or DLL files, e.g. libboost_python3-vc120-mt-1_64.lib or boost_python3-vc120-mt-1_64.dll instead of boost_python-vc120-mt-1_64.lib?

That is also regulated by defines.

In particular, adding to the beginning of my code (before #include <boost/python.hpp>) the line

#define BOOST_PYTHON_STATIC_LIB

forces MSVS to search file libboost_python3-vc120-mt-1_64.lib (or libboost_python-vc120-mt-1_64.lib), i.e. static lib. And vice versa line

#define BOOST_PYTHON_DYNAMIC_LIB

or

#define BOOST_ALL_DYN_LINK

can be used to import code from a dll.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!