Hi,

At Wed, 31 Jul 2002 04:36:54 +0900,
Edward Wilson wrote:
> I tried this also, and the problem I ran into on both Linux 2.4 and
> WinXP was that when ruby returned it was calling exit(), or something,
> because my whole application exited right after ruby did.
> 
> I thought it was just me.  Is this an acknowledged bug in the Ruby
> community; is anyone fixing this?  I was hoping to build and engine
> and had planned on using Ruby as the embedded language.  Are you
> saying this won't work.

Use rb_eval_string_protect() instead of ruby_run().

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

int main(int argc, char **argv)
{
    int state;
    ruby_init();
    ruby_script(argv[0]);
    rb_p(rb_eval_string_protect(argv[1], &state));
    if (state) {
	rb_p(ruby_errinfo);
    }
    return state;
}

-- 
Nobu Nakada