mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-30 23:02:06 +00:00
Add extending WASI plugin example
This commit is contained in:
14
examples/plugin-for-example/src/bin.rs
Normal file
14
examples/plugin-for-example/src/bin.rs
Normal 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");
|
||||
}
|
12
examples/plugin-for-example/src/main.rs
Normal file
12
examples/plugin-for-example/src/main.rs
Normal 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() {}
|
Reference in New Issue
Block a user