[C++-sig] assign a pointer to global object
Gennadiy Rozental
rogeeff at gmail.com
Wed Jul 23 20:45:40 CEST 2008
Roman Yakovenko <roman.yakovenko <at> gmail.com> writes:
> #include "boost/python.hpp"
>
> #include "1.h"
>
> namespace bp = boost::python;
>
> BOOST_PYTHON_MODULE(pyplusplus){
> bp::class_< AAA, boost::noncopyable >( "AAA" )
I do not want python to manage instance of AAA. I specified AAA*
as second argument.
> .def( bp::init< >() );
And they are not constructible from python
> bp::scope().attr("s_global") = bp::object( boost::ref( s_global ) );
This I am not sure what it has to do with my question.
I am not setting python global var.
But!
adding boost::ref to the
obj.attr( "aaa" ) = boost::ref( s_global );
did resolve the issue, though I am quite confused why it is required.
Gennadiy
More information about the Cplusplus-sig
mailing list