Add extending WASI plugin example

This commit is contained in:
Mark McCaskey
2019-04-26 18:45:18 -07:00
parent 6958f89443
commit ef3996a1c8
8 changed files with 103 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
extern "C" {
fn it_works() -> i32;
}
#[no_mangle]
pub fn plugin_entrypoint(n: i32) -> i32 {
println!("It works from inside WASI");
let result = unsafe { it_works() };
result + n
}
pub fn main() {
println!("hello");
}

View File

@@ -0,0 +1,12 @@
extern "C" {
fn it_works() -> i32;
}
#[no_mangle]
pub fn plugin_entrypoint(n: i32) -> i32 {
println!("Hello from inside WASI");
let result = unsafe { it_works() };
result + n
}
pub fn main() {}