diff options
Diffstat (limited to 'build/template')
| -rw-r--r-- | build/template/game.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/build/template/game.c b/build/template/game.c new file mode 100644 index 0000000..619b961 --- /dev/null +++ b/build/template/game.c @@ -0,0 +1,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; +} |
