/* uniruby-v1.c loadfunc an mruby interpreter in Unicon tectonics: gcc -o unirbuy.so -shared -fpic uniruby-v1.c \ /usr/lib/libmruby.a -lm */ #include #include #include #include #include "icall.h" int uniruby(int argc, descriptor *argv) { /* start up an mruby engine */ mrb_state *mrb = mrb_open(); if (!mrb) Error(500); /* Need a string of code parameter */ if (argc < 1) Error(103); ArgString(1); /* run the Ruby code, and return a universal answer */ mrb_load_string(mrb, StringVal(argv[1])); RetInteger(42); }