I'm new to SWIG and have been perusing the docs to figure out how to do
callbacks in Ruby. Basically, I'd like to be able to make a call in Ruby to
a C++ function passing in a Ruby callback method that the C++ function can
then execute at a later point when the operation is done.
As far as I can tell, this isn't as straightforward as I was hoping for. I
know I can use directors to allow my native code to call in to Ruby, but
that's more for general cases where, say, an event happened in native code
and I want to propagate that event to my Ruby code.
In this particular case, I'd like to make a call in Ruby, which fires off
an asynchronous operation in native code, and then I'd like to be called
back (in Ruby) when that operation has finished.
I was hoping somebody could point me in the right direction.
From: Klaus Kaempf <kkaempf@su...> - 2013-09-23 11:19:26
* Soren Dreijer <dreijer+list@...> [Sep 13. 2013 20:55]:
> Hi folks!
> I'm new to SWIG and have been perusing the docs to figure out how to do
> callbacks in Ruby. Basically, I'd like to be able to make a call in Ruby to
> a C++ function passing in a Ruby callback method that the C++ function can
> then execute at a later point when the operation is done.
for some nice examples.
Google for 'rb_funcall' for more examples.
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany