Hi,
I am running through the basic examples on the boost website for embedding boost::python.
My code currently reads:
#include
<iostream>
#include
"./include/Python.h"
#include
"./boost/python.hpp"
using
namespace boost::python;
int main(void)
{
Py_Initialize();
object main_module = import("__main__");
object main_namespace = main_module.attr("__dict__");
object ignored = exec("print Hello world",main_namespace);
return 0;
}
The program links successfully and begins running, however an access violation occurs (NULL pointer) at the first line after "py_initialize();" when i call import("__main__");
Visual studio 2010s debugger says the exception occurs at: line 74 in object_attributes.hpp:
inline object const_attribute_policies::get(object
const& target, char
const* key)
{
return python::getattr(target, key);
}
Python was built using Visual studio 2010 so i had access to the python debug library. Boost is version 1.45 and was built using :
bjam --build-type=complete msvc stage --with-python
I am linking against:
boost_python-vc100-mt-gd-1_45.lib
and
boost_python-vc100-mt-gd-1_45.dll
I have looked for soutions on the internet and have found nothing right now. Can anyone help me?
note: i am building my application in MSVC 2010, this should work though shouldn't it?
Dr Julian Bailey
Electronic Systems & Devices,
School of Electronics and Computer Science,
University of Southampton,
Southampton,
SO17 1BJ,
United Kingdom.
Tel. +44 (0)2380 593545
email:
jab@ecs.soton.ac.uk