Boost logo

Boost :

From: Marco Borm (mb.ml.boost_at_[hidden])
Date: 2005-03-09 11:38:57


Hi Boost/Python developers,

at first I have to say that I am no boost nor a python expert.
I've searched for hours now on the web for my problem but was unable to
find some solution for my problem:

Currently I am working on the possibility that an python-script is
called by an existing c++ object. This was "easy" to do with and without
the boost python-classes.

To make this more complicate, the script must be able to call some
member functions of this object.
So to make this possible I created an BOOST_PYTHON_MODULE() containing
the class and the to be called member function-definitions.
Now it is possible to create new instances of the class and call them
from python. It is also possible to do the following in my c++
object-code: "ret = boost::python::call<int>(PyFunction.ptr(), this );"

But now my problem: boost copies the object and passes only that copy to
the function.
Is it and how is it possible to make the object accessible to the
function within the python-script?
I have found some hints in the boost-source for using smartptr but I was
unable to use them as an parameter for call(): "TypeError: No to_python
(by-value) converter found for C++ type: class boost::shared_ptr<TYPE>".
I am also don't known if this is the right way to do.

Thanks for help!
Marco Borm


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk