A
Asfand Yar Qazi
Hi,
I plan on letting the user give me Proc objects that I will execute in
response to certain events (ala Socket-Slot thingy.)
I plan on calling the Proc objects from C code. But I'm not sure how.
Here's what I've guessed at so far:
An object of type T_OBJECT will be of class rb_cProc. (lets call it 'pr')
To call it with 2 arguments, ("Hello", 8007), we do this:
if(!rb_obj_is_instance_of(pr, rb_cProc))
/* raise, etc. */
rb_funcall(pr, rb_intern("call"), 2, rb_str_new2("Hello"), INT2NUM(8007))
Is there a more efficient way?
Thanks,
Asfand Yar
I plan on letting the user give me Proc objects that I will execute in
response to certain events (ala Socket-Slot thingy.)
I plan on calling the Proc objects from C code. But I'm not sure how.
Here's what I've guessed at so far:
An object of type T_OBJECT will be of class rb_cProc. (lets call it 'pr')
To call it with 2 arguments, ("Hello", 8007), we do this:
if(!rb_obj_is_instance_of(pr, rb_cProc))
/* raise, etc. */
rb_funcall(pr, rb_intern("call"), 2, rb_str_new2("Hello"), INT2NUM(8007))
Is there a more efficient way?
Thanks,
Asfand Yar