#include <stdio.h> #include <mruby.h> #include <mruby/compile.h> int main(void) { mrb_state *mrb = mrb_open(); if (!mrb) { /* handle error */ } puts("Executing Ruby code from C!"); mrb_load_string(mrb, "p 'hello world!'"); mrb_close(mrb); return 0; }
$ gcc -Iinclude hello.c build/host/lib/libmruby.a -lm -o hello.out
$ ./hello.out Executing Ruby code from C! "hello world!"
For more information on getting started, you can read this introduction blog post.
There was an error while loading. Please reload this page.