http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/30139?29887-31396
#include <ruby.h> #include <version.h> EXTERN VALUE ruby_top_self; int main() { int status; ruby_init(); ruby_init_loadpath(); rb_eval_string_protect("def my_func; puts 'hello'; end", &status); if (status != 0) { puts("大域脱出が起きた?"); } rb_funcall(ruby_top_self, rb_intern("my_func"), 0); return 0; }