Simple question: How to pass a C++ class reference to a callback?
Harri Pesonen
fuerte at sci.fi
Tue Sep 2 12:42:19 EDT 2003
David Abrahams wrote:
> "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.
Boost.Python is not 2.3 compatible yet, but it seems very good.
Harri
More information about the Python-list
mailing list