Advertisement
Guest User

Using Ruby as a slave interpreter

a guest
Jan 9th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include "ruby.h"
  2.  
  3. void uses_ruby() {
  4.   RUBY_INIT_STACK;
  5.   rb_eval_string("puts x");
  6. }
  7.  
  8. int main(int argc, char **argv) {
  9.   VALUE result;
  10.  
  11.   ruby_sysinit(&argc, &argv);
  12.   RUBY_INIT_STACK;
  13.   ruby_init();
  14.   ruby_init_loadpath();
  15.  
  16.   rb_eval_string("x = 1; puts x");
  17.  
  18.   uses_ruby();
  19.  
  20.   return ruby_cleanup(0);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement