[C++-sig] Re: Cannot believe what my eyes see: ACCES VIOLATION...

yakumoklesk at yahoo.es yakumoklesk at yahoo.es
Mon Sep 15 20:35:14 CEST 2003

On 15 Sep 2003 at 11:11, David Abrahams wrote:

> > #include <python.h>
>   ^^^^^^^^^^^^^^^^^^^
> Don't do this.  You should just include a Boost.Python header to get
> python.h.  When I get rid of that, the only crash I can reproduce
> goes away.  This is due to the debug-mode handling provided by
> wrap_python.hpp as described in
> http://www.boost.org/libs/python/doc/building.html#variants 

I had already tested the program not including the python.h header but also crashed.
The problem is that boost_python_debug.dll points to python23.dll instead of 
python23_d.dll. How have I to modify the project that builds boost_python_debug.dll in 
order to point to python23_d.dll instead of python23.dll?

> namespace py = boost::python;
> void func()
> {
>     py::object main_module
>            = py::extract<py::object>(PyImport_AddModule("__main__"));
>     PyRun_SimpleString("a = 3");
>     py::dict main_namespace(main_module.attr("__dict__"));
> }

This does not compile anyway, the first line gives this error:

cannot convert from 'struct boost::python::extract<class boost::python::api::object>' to 
'class boost::python::api::object'


David Lucena.

More information about the Cplusplus-sig mailing list