Chris Swierczewski wrote:

> void callEvent()
> virtual void onEvent(object eventData)

> Question: How do I wrap this intricate situation in Cython?

You may need to create a C++ subclass of the class to
be wrapped, with an onEvent() implementation that calls
a C function, passing it "this" as a parameter.

Then implement that C function in the .pyx file
(declaring it "public" so that it can be called from
the C++ code) so that it locates the Python wrapper
object and calls a Python method of it.

To map the C++ object back to the Python wrapper, you
could cast a reference to the wrapper to void * and
store it in a member of the C++ object (this effectively
makes it a borrowed reference, so that it won't keep
the wrapper object alive).

-- 
Greg
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to