Re: [C++-sig] Passing opaque data to C++ callback from Python

2014-12-18 Thread Peter LaDow
On Thu, Dec 18, 2014 at 8:10 PM, Stefan Seefeld wrote: > That sounds a bit confusing to me. :-) > Typically, if you associate state with a callback (a "closure"), you > think of it as an object whose member function is the callback. But > here, the callback function lives in Python, while you want

Re: [C++-sig] Passing opaque data to C++ callback from Python

2014-12-18 Thread Peter LaDow
Thanks for the reply! On Thu, Dec 18, 2014 at 9:16 AM, Stefan Seefeld wrote: > You defined 'do_something' as a callback, and registered it so it could > be called from C++, yes ? Then, in your implementation of Yes. At some pointer in the future, the Python function 'do_something' will be calle

[C++-sig] Passing opaque data to C++ callback from Python

2014-12-17 Thread Peter LaDow
I'm embedding Python (using boost::python) into an application plugin that uses callbacks. Essentially, I want to do something like: In Python (say test.py): def do_something(): ... register_callback(do_something) And on the C++ side I register the register_callback() function: void register