Hi,

> 2. The worst problem is that the called script interpreter makes and
> exit() to stop, wich has the disastrous consequence of stopping my
> calling program!
> Is there a function to stop cleanly the ruby interpreter so that I can
> replace each exit() into ruby's source code and continue my program
> after a ruby_run() call?

Function "rb_set_end_proc(func, data)" might help.

-- example --
#include <stdio.h>
#include <ruby.h>

static void
end_proc(data)
  VALUE data;
{
  puts(STR2CSTR(data));
}

main()
{
  ruby_init();
  rb_set_end_proc( end_proc, rb_str_new2("end_proc called") );
  rb_load_file("foo.rb");
  ruby_run();
}
--
M.Tanaka