Hi,

At Tue, 4 Mar 2008 14:57:36 +0900,
Suraj N. Kurapati wrote in [ruby-core:15767]:
> 1. Why does ruby_sysinit() cause a segfault in this program?

Because you pass wrong argument.  The second argument is a
pointer to char**, but you pass char** itself.

    char *fake_args[fake_argc];
    char **fake_argv = fake_args;

    ruby_sysinit(&fake_argc, &fake_argv);

> 2. Why does the program run OK even without ruby_sysinit()?  It
> seems ruby_sysinit() is not

It does system depend initialization for argv stuff.  You don't
use them.

> 3. Is it safe to "compile" the hello.rb file into a NODE in the main
> thread and then execute it inside a child thread?  Will there be any
> cross-thread violations by doing this?

I guess safe.

Your example does create new thread outside of ruby, the
interpreter doesn't know about the thread.  You should use
rb_thread_create() instead.

-- 
Nobu Nakada