Simple question: How to pass a C++ class reference to a callback?
David Abrahams
dave at boost-consulting.com
Tue Sep 2 11:34:58 EDT 2003
"T. Panbru" <panbru at comcast.net> writes:
> Try encapsulating your C++ class reference in a CObject, using:
>
> PyObject* PyCObject_FromVoidPtr( void* cobj, void (*destr)(void *))
> void* PyCObject_AsVoidPtr( PyObject* self)
>
> and so forth, to go back and forth between the C++ and Python realms.
>
> Check out the Python docs at:
>
> http://www.python.org/doc/2.3/api/cObjects.html
>
Or use one of the high-level wrapping tools such as Boost.Python
(http://www.boost.org/libs/python) which make this stuff much easier
and safer.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Python-list
mailing list