Hello mailinglist, I'm having trouble embedding python into c++. I use msvc-9.0, building 32-bit on a 64-architecture running win7pro. My Python version is 2.7.5. I have a python release and debug version (every file in C.\python27\libs exists with and without _d)
I would like to embed a couple of python scripts into a c++-application. Therefore I first tried to use the standard Python C-API. The problem I encountered during this is the same as described here<http://wangqiang8511.com/2012/07/18/embedding-python-in-c-application/>. So I tried to use boost.python but this was neither successfully. I'm receiving a acces violation. Here is my example source code: #include <Python.h> // without this line the compiler criticizes a missing python27.lib - // but I'm trying to build a debug-variant... #include <iostream> #include <boost/python.hpp> int main() { std::cout << "Boost.Python Test" << std::endl; // Start Python interpreter Py_Initialize(); // Setup sys.path boost::python::object sys = boost::python::import("sys"); // => throws "0x00000000 in Python_C_API_Test.exe: 0xC0000005: Access violation." in boost/libs/python/src/import.cpp boost::python::list path = boost::python::extract<boost::python::list>(sys.attr("path")); std::cout << "Module loaded" << std::endl; return 0; } I have build boost.python a dozend times with different flags. ("D:\boost_1_53_0>b2 --build-dir="D:\boost_1_53_0\python" toolset=msvc-9.0 link=shared variant=debug --python-debugging python" and using the resulting "boost_python-vc90-mt-gd-1_53.lib" What could I have missed? Do you have any solutions or approachs for me? Thanks in advance.
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig