yue_nicholas
8/15/2006 6:37:00 AM
Francis Cianfrocca wrote:
> For an example, look at the extension code in EventMachine (under
> branch version_0). The Ruby wrapper is in rubymain.cpp. The C wrapper
> is in cmain.cpp. Everything else is C++.
Thanks.
Looking at the code
static VALUE t_add_oneshot_timer (VALUE self, VALUE interval)
{
const char *f = evma_install_oneshot_timer (FIX2INT (interval));
if (!f || !*f)
rb_raise (rb_eRuntimeError, "no timer");
return rb_str_new2 (f);
}
I have a further question, the parameter I get in my call is an array
e.g.
["pos",[ 0, 0, 0],"dir",[1, 0, 1],"custom",[ 0, 1, 1, 2, 2, 2,
3, 1, 1]]
they are token-value pair
Should I process the array in cmain.cpp or rubymain.cpp
If in cmain.cpp I would need to include "ruby.h" for the definition of
"VALUE" right?
Cheers