Skip to content

Instantly share code, notes, and snippets.

@klutzy
Last active April 26, 2016 19:15
Show Gist options
  • Save klutzy/7819231 to your computer and use it in GitHub Desktop.
Save klutzy/7819231 to your computer and use it in GitHub Desktop.
Rust with Emscripten
// emscripten uses le32-unknown-nacl triple but rustc doesn't know it now.
// So just use similar target instead.
// `rustc hello.rs --target=i686-unknown-linux --emit-llvm -S --cfg libc`
// `emcc hello.ll -o hello.js`
// no `extern mod`.
#[no_std];
#[feature(macro_rules)];
use core::container::Container;
// https://github.com/thestinger/rust-core
mod core;
fn main() {
core::io::stdout().write(bytes!("hello world"));
}
#[lang="start"]
fn start(_: *u8, _: int, _: **u8) -> int {
main();
0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment