From: Rolando Abarca Date: 2009-04-22T08:46:06+09:00 Subject: Re: questions about embedding ruby 1.9 it's working now :-) with ruby version from stable snapshot :-D apparently it was a bug in the 1.9.1-p0 On Apr 21, 2009, at 6:42 PM, Rolando Abarca wrote: > On Apr 21, 2009, at 11:01 AM, Graham Agnew wrote: > >> Do you nee to add rb_init_loadpath()? >> >> ruby_sysinit(&argc, &argv); >> { >> RUBY_INIT_STACK; >> ruby_init(); >> ruby_init_loadpath(); > > actually, i'm setting the loadpath global myself: > > VALUE load_path = rb_gv_get(":"); > rb_funcall(load_path, rb_intern("push"), 1, > rb_str_new2(my_resource_path)); > > not sure if it's the right way though... But I'm running rb_require > and it finds the script just fine. > >> My own embedded ruby interpreter require's a file, and then calls >> functions within it. The rb_require and rb_funcall are wrapped in >> rb_protect. > > same as I'm doing it right now. The problem I'm having is with > exception handling. Do I need to call ruby_sysinit()? > >> The protected rb_require allows me to log any syntax errors in the >> required code. The protected rb_funcall allows me to catch any >> exceptions. > > mmm... I'm sorry, I lost you here. What function are you calling > with rb_funcall? > >> Ruby's own main.c uses something different to load the script: >> >> ruby_sysinit(&argc, &argv); >> { >> RUBY_INIT_STACK; >> ruby_init(); >> return ruby_run_node(ruby_options(argc, argv)); >> } > > yes, I saw that (I always turn to the source when lost :-P) > >> Cheers, >> Gra. cheers, -- Rolando Abarca M.