Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Last active July 13, 2016 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjunichi/bf9569894fac548bf78d8ddf38c56b40 to your computer and use it in GitHub Desktop.
Save kjunichi/bf9569894fac548bf78d8ddf38c56b40 to your computer and use it in GitHub Desktop.
mruby-julia
jl_function_t *func = jl_get_function(jl_main_module,"set_mrb_state");
jl_value_t *argument = jl_box_voidpointer((void*)mrb);
ret = jl_call1(func, argument);
jl = <<'EOS'
function set_mrb_state(ptr::Ptr{Void})
global MRB_MRB_STATE = ptr
end
EOS
Julia.eval(jl)
jl = <<'EOS'
function mrb_test()
r = ccall( (:mrb_load_string, "libmruby"), Void, (Ptr{Void},Cstring), MRB_MRB_STATE, "puts 'Hello,World!'")
end
EOS
Julia.eval(jl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment