B
Bill Kelly
Hi,
I'm just getting started embedding ruby, have set up
my main() as follows: (ala Pickaxe p.187, Embedding a
Ruby Interpreter.)
{
#ifdef _WIN32
// ruby win32 init
NtInitialize(&argc, &argv);
#endif
ruby_init();
ruby_script("embedded");
rb_load_file("test.rb");
ruby_run();
}
This seems work if rb_load_file() succeeds... But if
rb_load_file() fails to find the file, and tries to
raise an exception, the longjmp() is crashing.
I'm wondering if I'd be better off replacing the
rb_load_file() and ruby_run() with a call to
rb_eval_string("load test.rb") or some such?
(rb_eval_string_protect ??)
What I'd really like is to have ruby load and execute
a particular ruby file ("test.rb"), and then not call exit()
afterward. (But also not crash if file not found.)
Thanks for your help !
Regards,
Bill
I'm just getting started embedding ruby, have set up
my main() as follows: (ala Pickaxe p.187, Embedding a
Ruby Interpreter.)
{
#ifdef _WIN32
// ruby win32 init
NtInitialize(&argc, &argv);
#endif
ruby_init();
ruby_script("embedded");
rb_load_file("test.rb");
ruby_run();
}
This seems work if rb_load_file() succeeds... But if
rb_load_file() fails to find the file, and tries to
raise an exception, the longjmp() is crashing.
I'm wondering if I'd be better off replacing the
rb_load_file() and ruby_run() with a call to
rb_eval_string("load test.rb") or some such?
(rb_eval_string_protect ??)
What I'd really like is to have ruby load and execute
a particular ruby file ("test.rb"), and then not call exit()
afterward. (But also not crash if file not found.)
Thanks for your help !
Regards,
Bill