File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ Ruby code can also be written as a C string. This is similar to
7070the ` -e ` switch of the ` mruby ` program.
7171
7272~~~ c
73- #include " mruby.h"
74- #include " mruby/compile.h"
73+ #include < mruby.h>
74+ #include < mruby/compile.h>
7575
7676int
7777main (void)
@@ -81,14 +81,14 @@ main(void)
8181 // mrb_load_nstring() for strings without null terminator or with known length
8282 mrb_load_string(mrb, "puts 'hello world'");
8383 mrb_close(mrb);
84+ return 0;
8485}
8586~~~
8687
8788To compile and link:
8889
8990~~~
90- $ gcc -std=c99 -Imruby/include test_program.c -o test_program
91- test_program.o mruby/build/host/lib/libmruby.a
91+ $ gcc -std=c99 -Imruby/include test_program.c -o test_program mruby/build/host/lib/libmruby.a -lm
9292~~~
9393
9494To execute:
@@ -200,9 +200,9 @@ To execute this bytecode the following boilerplate has to be written (name this
200200file ` test_stub.c ` ):
201201
202202~~~ c
203- #include " mruby.h"
204- #include " mruby/irep.h"
205- #include " test_program.c"
203+ #include < mruby.h>
204+ #include < mruby/irep.h>
205+ #include < test_program.c>
206206
207207int
208208main (void)
@@ -211,6 +211,7 @@ main(void)
211211 if (!mrb) { /* handle error * / }
212212 mrb_load_irep(mrb, test_symbol);
213213 mrb_close(mrb);
214+ return 0;
214215}
215216~~~
216217
@@ -219,7 +220,7 @@ This will read the bytecode from the array and executes it immediately:
219220To compile and link:
220221
221222~~~
222- $ gcc -std=c99 -Imruby/include test_stub.c -o test_program mruby/build/host/lib/libmruby.a
223+ $ gcc -std=c99 -Imruby/include test_stub.c -o test_program mruby/build/host/lib/libmruby.a -lm
223224~~~
224225
225226To execute:
You can’t perform that action at this time.
0 commit comments