Embedding Ruby 1.9

K

Kambiz Bizi

from main.c I have learned to load and run a single script but how can I
load and run several scripts? When I call ruby_run_node for a second
time I get a "Segmentation fault" error.

This is OK:
char * f[] = {"","script.rb"};
void* node = ruby_options(2,f);
ruby_run_node(node);

but obviously I can not load and run the second script the same way, the
code

char * f2[] = {"","script2.rb"};
void* node2 = ruby_options(2,f2);
ruby_run_node(node2);

generates the following output:

*********************************
: warning: already initialized constant Enable
: [BUG] Segmentation fault
ruby 1.9.0 (2007-12-25 revision 14709) [x86_64-linux]

-- control frame ----------
c:0002 p:-845116 s:0004 b:0004 l:000003 d:000003 TOP
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP <dummy
toplevel>:103
---------------------------
-- backtrace of native function call (Use addr2line) --
0x7f0d703a7b52
0x7f0d702c513b
0x7f0d702c5242
0x7f0d70351ff9
0x7f0d6f7b7100
0x7f0d6fae2c70
-------------------------------------------------------

Run failed. Exit value 134.
*********************************

I would also like to know how to run different scripts independently (in
separate scopes).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top