Skip to content

Instantly share code, notes, and snippets.

@sandinist
Last active December 12, 2015 06:38
Show Gist options
  • Save sandinist/4730536 to your computer and use it in GitHub Desktop.
Save sandinist/4730536 to your computer and use it in GitHub Desktop.
今日のmruby遊び
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/string.h>
int main(int argc, char * argv[]) {
mrb_state *mrb;
mrb_value value;
char *code;
mrb = mrb_open();
code = argv[1];
//mrb_load_string(mrb, "p ['Hello', 'mruby']");
//value = mrb_load_string(mrb, "'hi'");
//value = mrb_load_string(mrb, code);
value = mrb_str_new2(mrb, "hi c type");
//value = mrb_fixnum_value(123);
char *s = RSTRING_PTR(value);
printf("value: %s", s);
if (mrb->exc){
mrb_p(mrb, mrb_obj_value(mrb->exc));
return 1;
}
mrb_p(mrb, value);
//printf("* hi\n");
mrb_close(mrb);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment