From: ts Date: 2001-02-08T03:07:41+09:00 Subject: [ruby-talk:10520] Re: Embedded Ruby (Part III) >>>>> "O" == Olivier CARRERE writes: O> I've got another question : what use is the 'state' used in O> rb_eval_string_protect() wich is not in rb_eval_string()? It is used to indicate an error. If you have an error with rb_eval_string() ruby will call rb_raise() and there are many chance that your program crash. With rb_eval_string_protect(), rb_eval_string() is protected and ruby return the error in state, you can write something like (if the error is not fatal) rb_eval_string_protect(string, &state); if (state) { VALUE c = rb_funcall(rb_gv_get("$!"), rb_intern("to_s"), 0); fprintf(stderr, "ERROR %s", RSTRING(c)->ptr); } Guy Decoux