Created
March 19, 2012 20:25
-
-
Save intractable/2126721 to your computer and use it in GitHub Desktop.
by-hand linkage against librubinius.a/so
This file contains 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
// #include <rubinius/environment.hpp> | |
#include <vm/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(env.state); | |
return env.exit_code(env.state); | |
} |
This file contains 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
#!/usr/bin/env bash | |
# Where's rubinius? | |
BUILD_DIR=/repo/root | |
# static linkage | |
g++ -Wl,-all_load -L${BUILD_DIR}/rubinius/lib -I${BUILD_DIR}/rubinius/include -I${BUILD_DIR}/rubinius/include/rubinius -I. -I./vm vm/librubinius.a main.cpp -o main_static | |
# dynamic linkage | |
g++ -L${BUILD_DIR}/rubinius/lib -I${BUILD_DIR}/rubinius/include -I${BUILD_DIR}/rubinius/include/rubinius -I. -I./vm -lrubinius main.cpp -o main_dynamic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment