I need to access ruby_errinfo and initially I've written (ruby_errinfo is
not in ruby.h)
[...]
extern VALUE ruby_errinfo;
[...]
Finally I use rb_global_entry() but its definition is also not in ruby.h.
Is there another way to access this variable ?
I want to do something like this :
aestivum% cat toto.c
#include <ruby.h>
static struct global_entry *errinfo;
static VALUE toto_eCatch;
static VALUE titi() { rb_raise(toto_eCatch, "ESSAI"); }
static VALUE t_catch() { return rb_gvar_get(errinfo); }
static VALUE
toto()
{
VALUE c = rb_rescue(titi, 0, t_catch, 0);
if (rb_obj_is_kind_of(c, toto_eCatch))
rb_warn("OK kind_of");
return Qtrue;
}
Init_toto()
{
toto_eCatch = rb_define_class("TotoCatch", rb_eStandardError);
errinfo = (struct global_entry *)rb_global_entry(rb_intern("$!"));
toto();
}
aestivum%
Guy Decoux