Created
January 21, 2019 01:05
-
-
Save bjfish/4381be789be802e9f6c7c481f451a60e to your computer and use it in GitHub Desktop.
Wasmer Wasm Sample App
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
// Defines functions to import from "env" namespace | |
extern "C" { | |
fn print_str(ptr: *const u8, len: usize); | |
} | |
#[no_mangle] | |
pub extern fn hello_wasm(){ | |
let message = "Hello World"; | |
unsafe { | |
print_str(message.as_ptr(), message.len()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment