P
Phil Tomson
I've basically taken the embedding example from pickaxeII and the only
thing I've added is for the Ruby program to do a 'require' of a file known
to exist in the library.
Here is the relevant part of the C-side code:
//summer.c
int main(void) {
int value;
int* next = Values;
ruby_init();
ruby_init_loadpath();
ruby_script("embedded");
rb_require("sum.rb"); //ruby script is sum.rb
ruby_finalize();
exit(0);
}
//end of summer.c
So the ruby_init_loadpath() should be setting up the loadpath correctly,
and I can confirm this by making the ruby script to be required (sum.rb)
like so:
#sum.rb
puts $:
Now if I run summer, I get:
$ ./summer
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux
thing I've added is for the Ruby program to do a 'require' of a file known
to exist in the library.
Here is the relevant part of the C-side code:
//summer.c
int main(void) {
int value;
int* next = Values;
ruby_init();
ruby_init_loadpath();
ruby_script("embedded");
rb_require("sum.rb"); //ruby script is sum.rb
ruby_finalize();
exit(0);
}
//end of summer.c
So the ruby_init_loadpath() should be setting up the loadpath correctly,
and I can confirm this by making the ruby script to be required (sum.rb)
like so:
#sum.rb
puts $:
Now if I run summer, I get:
$ ./summer
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux