I have a problem with storing reference to Python object inside C++.
The following Boost.Python wrapping class:
#include
using namespace boost;
using namespace boost::python;
namespace cmodule
{
object y;
void setY(object y1) { y = y1; }
}
using namespace cmodule;
BOOST_PYTHON_MODULE(cm
Hi Jim,
In my opinion “object y;” is just declaration of global object, not static
variable of some class (in this case you are right: explicit declaration
needed, something like: “object MyStaticClass::y;”).
I have changed setY function to:
void setY(PyObject * y1) { y = object(handle<>(y1));