public R_VAL DoString(string str) { #if MRUBY int arena = RubyDLL.mrb_gc_arena_save(rb_state); IntPtr mrbc_context = RubyDLL.mrbc_context_new(rb_state); RubyDLL.mrbc_filename(this, mrbc_context, "*interactive*"); var ret = RubyDLL.mrb_load_string_cxt(rb_state, RubyDLL.ToCBytes(str), mrbc_context); RubyDLL.mrbc_context_free(rb_state, mrbc_context); if (RubyDLL.mrb_has_exc(rb_state)) { Console.WriteLine(GetExceptionBackTrace()); RubyDLL.mrb_exc_clear(rb_state); } RubyDLL.mrb_gc_arena_restore(rb_state, arena); return(ret); #else int status; // return RubyDLL.rb_eval_string ( str ); return(RubyDLL.rb_eval_string_protect(str, out status)); #endif }