E
Edwin Pratomo
good day all,=0A=0Athe following rb_rescue2 works with old versions - teste=
d with 1.8.5 and 1.8.6. but crashes 1.9.0-0. =0Asomething's wrong with the =
code or is it a problem in 1.9.0-0's rb_rescue2?=0A=0A#include <ruby.h>=0A#=
include <stdio.h>=0A=0A#ifndef RSTRING_PTR=0A#define RSTRING_PTR(o) RSTRING=
(o)->ptr=0A#endif=0A=0Astatic VALUE eval_failed(VALUE v, VALUE exc)=0A{=0A =
printf("eval_failed\n");=0A return exc;=0A}=0A=0Aint main() {=0A V=
ALUE retv;=0A int i;=0A char *codes[] =3D {=0A "de foo; puts \=
"in foo()\"; end",=0A "1/0"=0A };=0A =0A ruby_init();=0A =
ruby_init_loadpath();=0A=0A for (i =3D 0; i < 2; i++) {=0A#ifdef USE_RB=
_STR_NEW2=0A retv =3D rb_rescue2(rb_eval_string, rb_str_new2(codes[i=
]), eval_failed, Qnil, rb_eException, 0);=0A#else=0A retv =3D rb_res=
cue2(rb_eval_string, (VALUE)codes, eval_failed, Qnil, rb_eException, 0);=
=0A#endif=0A if (rb_obj_is_kind_of(retv, rb_eException))=0A {=
=0A VALUE msg =3D rb_funcall(retv, rb_intern("message"), 0);=0A =
printf("Error: %s\n", RSTRING_PTR(msg));=0A }=0A }=0A=
=0A ruby_finalize();=0A exit(0);=0A}=0A=0Argds,=0AEdwin=0A=0A=0A=0A=
=0A=0A ________________________________________________________ =0ABer=
gabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi Y=
ahoo! Answers saat ini juga di http://id.answers.yahoo.com/[/i]
d with 1.8.5 and 1.8.6. but crashes 1.9.0-0. =0Asomething's wrong with the =
code or is it a problem in 1.9.0-0's rb_rescue2?=0A=0A#include <ruby.h>=0A#=
include <stdio.h>=0A=0A#ifndef RSTRING_PTR=0A#define RSTRING_PTR(o) RSTRING=
(o)->ptr=0A#endif=0A=0Astatic VALUE eval_failed(VALUE v, VALUE exc)=0A{=0A =
printf("eval_failed\n");=0A return exc;=0A}=0A=0Aint main() {=0A V=
ALUE retv;=0A int i;=0A char *codes[] =3D {=0A "de foo; puts \=
"in foo()\"; end",=0A "1/0"=0A };=0A =0A ruby_init();=0A =
ruby_init_loadpath();=0A=0A for (i =3D 0; i < 2; i++) {=0A#ifdef USE_RB=
_STR_NEW2=0A retv =3D rb_rescue2(rb_eval_string, rb_str_new2(codes[i=
]), eval_failed, Qnil, rb_eException, 0);=0A#else=0A retv =3D rb_res=
cue2(rb_eval_string, (VALUE)codes, eval_failed, Qnil, rb_eException, 0);=
=0A#endif=0A if (rb_obj_is_kind_of(retv, rb_eException))=0A {=
=0A VALUE msg =3D rb_funcall(retv, rb_intern("message"), 0);=0A =
printf("Error: %s\n", RSTRING_PTR(msg));=0A }=0A }=0A=
=0A ruby_finalize();=0A exit(0);=0A}=0A=0Argds,=0AEdwin=0A=0A=0A=0A=
=0A=0A ________________________________________________________ =0ABer=
gabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi Y=
ahoo! Answers saat ini juga di http://id.answers.yahoo.com/[/i]