From: Beoran Aegul Date: 2010-08-22T17:36:03+09:00 Subject: [ruby-core:31821] [Feature #3731] Easier Embedding API for Ruby Issue #3731 has been updated by Beoran Aegul. Dear Asher, Well, I certainly agree documentation should be improved for this use case! :) However, the problem with what you suggest is that it doesn't work more than once. For example; I get a segmentation violation (crash) with a "You may encounter a bug of Ruby interpreter." on the second call to ruby_run_node(); if I try this on a ruby1.9.1 p0: #include RUBY_GLOBAL_SETUP int main( int argc __attribute__((unused)), char *argv[] __attribute__((unused)) ) { RUBY_INIT_STACK ruby_init(); { char* options[] = { "", "-e", "puts 'hello'" }; void* node = ruby_options( 2, options ); char* options2[] = { "", "-e", "puts 'world'" }; void* node2 = ruby_options( 2, options2 ); ruby_run_node( node ); ruby_run_node( node2 ); } } It may be that this bug is fixed in later versions, but I still have to install them to try. Another problem is that it's a rather unwieldy API. It's nicer if you can run multiple scripts, or call rb_eval_string multiple times. It's also nice if you can catch syntax errors in the ruby files loaded and handle them on the C side. Kind Regards, B. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3731 ---------------------------------------- http://redmine.ruby-lang.org