Skip to content

Instantly share code, notes, and snippets.

@nasser
Created August 5, 2011 22:44
Show Gist options
  • Save nasser/1128709 to your computer and use it in GitHub Desktop.
Save nasser/1128709 to your computer and use it in GitHub Desktop.
Rubinius Embed Example
puts __FILE__
def salad
"caesar"
end
foo
puts salad
puts __FILE__
puts "This is file b"
#include "embed.h"
int main(int argc, char** argv) {
rbx_ctx rbx = rbx_create_context();
printf("** rbx_require_file\n");
rbx_require_file(rbx, "req.rb");
printf("\n** rbx_eval_file\n");
rbx_eval_file(rbx, "a.rb");
printf("\n** rbx_eval_file\n");
rbx_eval_file(rbx, "b.rb");
printf("\n** rbx_eval\n");
rbx_eval(rbx, "puts 'Hello, World!';10.times { |i| puts \"Hello, W#{'o' * (i+2)}rld!\" }");
rbx_close_context(rbx);
return 0;
}
def foo
puts "foo method called"
end
puts "#{__FILE__} required"
@Beyarz
Copy link

Beyarz commented Apr 12, 2019

Can you share embed.h too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment