Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
Created April 9, 2011 17:38
Show Gist options
  • Save jasonroelofs/911589 to your computer and use it in GitHub Desktop.
Save jasonroelofs/911589 to your computer and use it in GitHub Desktop.
#include <rubinius/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();
}
require 'rbconfig'
config = RbConfig::CONFIG
FLAGS = %|-L#{config["libdir"]} -I#{config["includedir"]} -I#{config["includedir"]}/rubinius|
desc "Build the test with shared linkage"
task :build_shared do
cmd = "g++ #{FLAGS} #{config["LIBRUBYARG_SHARED"]} main.cpp -o main"
sh cmd
end
desc "Build the test with static linkage (fails badly with LLVM linker errors)"
task :build_static do
cmd = "g++ #{FLAGS} #{config["LIBRUBYARG_STATIC"]} main.cpp -o main"
sh cmd
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment