Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created April 17, 2015 00:09
Show Gist options
  • Save havenwood/afc514180e9aa18caaf2 to your computer and use it in GitHub Desktop.
Save havenwood/afc514180e9aa18caaf2 to your computer and use it in GitHub Desktop.
"Hello, world!" from MRuby embedded in Crystal
@[Link("mruby")]
lib MRuby
type MRubyState = Void*
fun open = mrb_open : MRubyState
fun load_string = mrb_load_string(mrb : MRubyState, code : Pointer(UInt8))
fun close = mrb_close(mrb : MRubyState)
end
CODE = <<-RUBY_CODE
puts 'Hello, world!'
RUBY_CODE
MRB = MRuby.open
MRuby.load_string MRB, CODE
MRuby.close MRB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment