#include <stdlib.h>
#include <stdio.h>
/* Include the mruby headers */
#include <mruby.h>
#include <mruby/proc.h>
#include <mruby/data.h>
#include <mruby/compile.h>
mrb_value my_func(mrb_state *mrb,mrb_value self);
void main(void)
{
mrb_state *mrb = mrb_open();
mrb_define_method(mrb,mrb->object_class,"func",my_func,ARGS_NONE());
FILE *fp=fopen("/home/hjj/mruby/bin/p.mrb","rb");
mrb_int n = mrb_load_irep(mrb,fp);
mrb_run(mrb, mrb_proc_new(mrb,mrb->irep[n]), mrb_top_self(mrb));
}
mrb_value my_func(mrb_state *mrb,mrb_value self)
{
return mrb_fixnum_value(111);
}
本人初学 mruby,不知道这是什么问题,有没有人可以帮忙解决一下啊!谢谢~~~~