We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
#include <stdlib.h> #include <stdio.h> /* Include the mruby header */ #include <mruby.h> #include <mruby/compile.h> int main(void) { mrb_state *mrb = mrb_open(); char code[] = "p 'hello world!'"; printf("Executing Ruby code from C!\n"); mrb_load_string(mrb, code); return 0; }
compile & link
$ gcc -Iinclude hello.c build/host/lib/libmruby.a -lm -o hello.out
execution
$ ./hello.out Executing Ruby code from C! "hello world!"
For more information on getting started, you can read this introduction blog post.