From 65fbc1e21355ca962c6da74f106cddfe5af9ea7a Mon Sep 17 00:00:00 2001 From: magewhopper Date: Thu, 5 Jul 2012 06:03:56 -0700 Subject: [PATCH] add third param context(NULL) to mrb_parse_string() --- Hello-World.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Hello-World.md b/Hello-World.md index a0f007e..e17b072 100644 --- a/Hello-World.md +++ b/Hello-World.md @@ -6,8 +6,7 @@ #include #include #include -// to be replaced by #include -#include +#include int main(void) { @@ -16,7 +15,7 @@ int main(void) char code[] = "p 'hello world!'"; printf("Executing Ruby code from C!\n"); - p = mrb_parse_string(mrb, code); + p = mrb_parse_string(mrb, code, NULL); int n; n = mrb_generate_code(mrb, p->tree); mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); @@ -26,5 +25,15 @@ int main(void) return 0; } ``` +compile & link +``` +$ gcc -Iinclude hello.c lib/libmruby.a -lm -o hello.out +``` +execute +``` +$ ./hello.out +Executing Ruby code from C! +"hello world!" +``` For more information on [getting started](http://matt.aimonetti.net/posts/2012/04/25/getting-started-with-mruby/), you can read this [introduction blog post](http://matt.aimonetti.net/posts/2012/04/25/getting-started-with-mruby/). \ No newline at end of file