Created
November 11, 2013 06:16
-
-
Save anonymous/7408714 to your computer and use it in GitHub Desktop.
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
void foo(); | |
void factory(); | |
struct { | |
int version; | |
void *entry_data; | |
int entry_len; | |
void *children_data; | |
int children_len; | |
void *f; | |
} _rust_crate_map_toplevel = { | |
2, | |
0, 0, | |
0, 0, | |
factory | |
}; | |
int main() { | |
foo(); | |
return 0; | |
} |
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
extern mod rustuv; | |
use std::rt; | |
use std::rt::rtio::EventLoop; | |
use std::ptr; | |
#[no_mangle] | |
pub extern "C" fn factory() -> ~EventLoop { | |
rustuv::uvio::new_loop() | |
} | |
#[no_mangle] | |
pub extern "C" fn foo() { | |
do rt::start(0, ptr::null()) { | |
println!("hello"); | |
}; | |
} |
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
all: libfoo.dylib bar.c | |
clang bar.c -o bar -L. -lfoo -Wl,-rpath,`pwd` | |
libfoo.dylib: foo.rs | |
rustc --lib foo.rs | |
ln -nsf libfoo-*.dylib libfoo.dylib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment