1 2 // Copyright 2017, 2018 Peter Dimov. 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // 6 // See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #if defined(_WIN32) 10 # define BOOST_PYTHON_STATIC_LIB 11 #endif 12 #include <boost/python.hpp> 13 #include <boost/core/lightweight_test.hpp> 14 15 namespace python = boost::python; 16 main()17int main() 18 { 19 Py_Initialize(); 20 21 python::dict env; 22 python::object result = python::exec( "number = 42", env, env ); 23 24 BOOST_TEST_EQ( python::extract<int>( env["number"] ), 42 ); 25 26 return boost::report_errors(); 27 } 28