# Embedding Ruby 1.9

**URL:** <https://www.ruby-forum.com/t/embedding-ruby-1-9/145316>\
**Category:** Ruby\
**Created:** [August 7, 2008, 9:21pm UTC](https://www.ruby-forum.com/t/embedding-ruby-1-9/145316 "2008-08-07T21:21:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kambiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/eb8c5e/32.png) [@kambiz](https://www.ruby-forum.com/u/kambiz)\
**Post date:** [August 7, 2008, 9:21pm UTC](https://www.ruby-forum.com/t/embedding-ruby-1-9/145316/1 "2008-08-07T21:21:18Z")

</div>

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 :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).
