From: jefflholle (jeff.holle_at_[hidden])
Date: 2002-01-05 01:19:06
I'm failing to understand examples of this in boost_1_24_0
Basically, my problem is in obtaining the PyObject * value needed to
make a callback.
The simplest example of this is abstract.cpp/test_abstract.py.
It is more complicated that what I'm after since it involves an
abstract C++ class that is interfaced to python.
I've modified this module to reflect what I'm really after and gotten
it to behave in the manner that my code is. It follows:
// Example by Ullrich Koethe
#pragma warning( disable: 4541)
virtual std::string test() = 0;
std::cout << "Got here" << std::endl;
PyObject * m_self;
a_class.def(boost::python::constructor<>()); // wrap a constructor
This module doesn't compile for want of a default constructor in
Abstract_callback. It doesn't exist because I want to make the
constructor of this class provide the needed PyObject, so a callback
can be done.
If I modify the "boost::python::constructor<>());"
to "boost::python::constructor<Python *>());" I run into conversion
problems. Actually, I've found that I run into such trouble passing
any pointer and a lot of complex things.
How do I do this?
One more thing. I've tried just adding another method to deliver the
self pointer of the class and get a runtime error saying that a
string or unicode object expected but an instance was found when
calling it from python.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk