Created
April 17, 2015 00:09
-
-
Save havenwood/afc514180e9aa18caaf2 to your computer and use it in GitHub Desktop.
"Hello, world!" from MRuby embedded in Crystal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@[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