From: ts Date: 2003-08-06T21:51:18+09:00 Subject: Re: Ruby 1.8.0 embedded >>>>> "S" == Stefan Staudt writes: S> If the ruby script is o.k. I have no problems, but if the ruby script has S> an error (state not equal to 0) I get problems. You are lucky svg% cat test.c #include "ruby.h" static void tt(char *path) { int state = 0; ruby_init(); ruby_init_loadpath(); rb_load_protect(rb_str_new2(path), Qfalse, &state); if (state != 0) { VALUE err = rb_inspect(rb_gv_get("$!")); fprintf(stderr, "error %s\n", RSTRING(err)->ptr); } ruby_cleanup(state); } int main() { tt("b.rb"); tt("b.rb"); } svg% svg% cat b.rb #!/usr/bin/ruby p Object svg% svg% ./test Object error # Segmentation fault svg% S> Is there a bug in ruby_cleanup or shoul I use other functions? ruby_init() and ruby_cleanup() don't do what you think. S> Next question: is it possible to stop the ruby interpreter when S> interpreting a script? How can this be done? use 2 threads S> Another question: is it possible to "step" through a ruby script when ruby S> is embedded? Well, you can define a trace function. Guy Decoux