From: Masoom Date: 2008-05-20T21:09:44+09:00 Subject: Re: [ruby-core:16807] Embedding Ruby1.9: seg fault ------=_Part_9715_8217212.1211285386457 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline that means current vm is not embeddable ? by min. src I guess you mean the src file to produce the crash here it is // this is in file my_ruby_funcs.c int init_ruby_vm(int argc, char* argv[]) { // Init Ruby VM ruby_sysinit(&argc, &argv); ruby_init(); // This will bring in Standard Ruby Library // Explicit call to this function is required since for standard RubyVM // it is called from ruby_process_options(argc,argv), we can/should not // pass 'our' options to RubyVM's command parser since in all probability // it will be irrelevant(to RubyVM). ruby_init_loadpath(); // load the script and execute return ruby_run_node( rb_load_file( "my_cool_script.rb")); } the main() entry point is in another file, say my_main.c // my main() entry point int main(int argc, char* argv[]) { return init_ruby_vm(&argc, &argv); } observe that I am calling init_ruby_vm() from main() and init_ruby_vm() is in some other file, is this scheme of things mess with garbage collection ? since gc needs to know the stack address of main thread (which I think it gets here in this setup). Masoom Shaikh On Tue, May 20, 2008 at 4:21 PM, SASADA Koichi wrote: > Hi, > > Masoom wrote: > >> I am trying to embed the interpreter inside my executable but it crashes >> @ vm.c line # 69 ----------- if (iseq->type != ISEQ_TYPE_TOP) { >> >> any thoughts ? >> > > Embed is next target of my development. Can you make minimum case (minimum > source) to cause it? > > -- > // SASADA Koichi at atdot dot net > > ------=_Part_9715_8217212.1211285386457 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline that means current vm is not embeddable ? by min. src I guess you mean the src file to produce the crash
here it is

// this is in file my_ruby_funcs.c
int init_ruby_vm(int argc, char* argv[])
{
    // Init Ruby VM
    ruby_sysinit(&argc, &argv);
    ruby_init();
    // This will bring in Standard Ruby Library
    // Explicit call to this function is required since for standard RubyVM
    // it is called from ruby_process_options(argc,argv), we can/should not
    // pass 'our' options to RubyVM's command parser since in all probability
    // it will be irrelevant(to RubyVM).
    ruby_init_loadpath();

    // load the script and execute
    return ruby_run_node( rb_load_file( "my_cool_script.rb"));
}

the main() entry point is in another file, say my_main.c
// my main() entry point
int main(int argc, char* argv[])
{
    return init_ruby_vm(&argc, &argv);
}

observe that I am calling init_ruby_vm() from main() and init_ruby_vm() is in some other file, is this scheme of things mess with garbage collection ? since gc needs to know the stack address of main thread (which I think it gets here in this setup).

Masoom Shaikh

On Tue, May 20, 2008 at 4:21 PM, SASADA Koichi <ko1@atdot.net> wrote:
Hi,


Masoom wrote:
I am trying to embed the interpreter inside my executable but it crashes
@ vm.c line # 69  -----------   if (iseq->type != ISEQ_TYPE_TOP) {

any thoughts ?

Embed is next target of my development.  Can you make minimum case (minimum source) to cause it?

--
// SASADA Koichi at atdot dot net


------=_Part_9715_8217212.1211285386457--