Callback from C++ to Python, how to pass args?
Bram Stolk
bram at sara.nl
Mon Aug 14 06:59:00 EDT 2000
Hello all,
I've been reading chapter 1.6 "Calling Python funcs from C" of
"Extending and Embedding the Python Interpreter".
Here, an example is used that does a callback from C to a
Python func.
When doing this, the func Py_BuildValue() is used to build
the argument list for the callback.
This gives me problems when I want to pass objects in the
argument list, instead of plain ints and floats.
I am looking for a way to pass a ptr to a C++ object as
an argument to the called back Python script function.
Using the "O" formatter does not work, neither does a
conversion to CObject first, because the script func will
then simply get a CObject, and not a properly typed object.
To clarify: the object I want to pass is a C++ object, which
has been given Python support using SWIG.
Any help greatly appreciated,
Bram
--
------------------------------------------------------------------------------
Bram Stolk, VR Specialist.
SARA Academic Computing Services Amsterdam, PO Box 94613, 1090 GP AMSTERDAM
email: bram at sara.nl Phone +31-20-5923059 Fax +31-20-6683167
"I heard if you play the NT-4.0-CD backwards, you get a satanic message."
"Thats nothing, if you play it forward, it installs NT-4.0"
------------------------------------------------------------------------------
More information about the Python-list
mailing list