I am facing an issue with calling of mruby VM in C. I could invoke the mruby vm and execute the ruby code from C. I could also trigger the methods defined in the ruby code as well. But I am facing issue while trying to read the return value of the ruby method. I have provided my example scenario below.
CODE:
#include <stdlib.h>
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>
int main(void)
{
  mrb_state *mrb = mrb_open();
  char code[] = "def helloworld() return'OK' end";
  printf("Executing Ruby code from C!\n");
  mrb_load_string(mrb, code);
  mrb_load_string(mrb, "helloworld()");
  // How to read the return value?
  return 0;
}
I am not sure if this is the right way of calling the ruby methods? I couldnt find any documentation or examples on the web. Anyone who tried calling ruby code via c (using mruby) can you please help me?
Regards,
 
    