blob: 619b96134136631ae937a14a0336a87f2d660d8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// emcc -s WASM=1 -Os -I ../include/ hello_ruby.c web/lib/libmruby.a -o hello_ruby.js --closure 1
#include <mruby.h>
#include <mruby/compile.h>
int
main(void)
{
mrb_state *mrb = mrb_open();
if (!mrb) { /* handle error */ }
// mrb_load_string(mrb, str) to load from NULL terminated strings
// mrb_load_nstring(mrb, str, len) for strings without null terminator or with known length
mrb_load_string(mrb, "puts 'hello world'");
mrb_load_string(mrb, "Ye.c_method");
mrb_close(mrb);
return 0;
}
|