Skip to content

Instantly share code, notes, and snippets.

@nasser
Created August 2, 2011 11:36
Show Gist options
  • Save nasser/1120033 to your computer and use it in GitHub Desktop.
Save nasser/1120033 to your computer and use it in GitHub Desktop.
$ cat main.cpp
#include "environment.hpp"
#include <iostream>
using namespace rubinius;
int main(int argc, char** argv) {
Environment env(argc, argv);
env.setup_cpp_terminate();
try {
const char* runtime = getenv("RBX_RUNTIME");
if(!runtime) runtime = RBX_RUNTIME;
env.run_from_filesystem(runtime);
} catch(std::runtime_error& e) {
std::cout << "Runtime exception: " << e.what() << std::endl;
} catch(...) {
std::cout << "Unknown exception detected." << std::endl;
}
env.halt();
return env.exit_code();
}
$ g++ -Ivm -force_load vm/librubinius-static.a main.cpp -o main
$ ./main
irb(main):001:0> Rubinius
=> Rubinius
irb(main):002:0> Rubinius::VERSION
=> "1.2.5dev"
irb(main):003:0> require "openssl"
=> true
irb(main):004:0> require 'digest/sha1'
=> true
irb(main):005:0> c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
=> #<OpenSSL::Cipher::Cipher:0x10c4>
irb(main):006:0> c.encrypt
=> #<OpenSSL::Cipher::Cipher:0x10c4>
irb(main):007:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment