feat: add example4
This commit is contained in:
7
__wasm/wasmtime/wasms/simple_rust_wasm/Cargo.lock
generated
Normal file
7
__wasm/wasmtime/wasms/simple_rust_wasm/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "simple_rust_wasm"
|
||||
version = "0.1.0"
|
||||
12
__wasm/wasmtime/wasms/simple_rust_wasm/Cargo.toml
Normal file
12
__wasm/wasmtime/wasms/simple_rust_wasm/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "simple_rust_wasm"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
crate-type = ['cdylib']
|
||||
|
||||
[dependencies]
|
||||
|
||||
7
__wasm/wasmtime/wasms/simple_rust_wasm/justfile
Normal file
7
__wasm/wasmtime/wasms/simple_rust_wasm/justfile
Normal file
@@ -0,0 +1,7 @@
|
||||
_:
|
||||
@just --list
|
||||
|
||||
build:
|
||||
cargo build --target wasm32-unknown-unknown
|
||||
|
||||
|
||||
12
__wasm/wasmtime/wasms/simple_rust_wasm/src/lib.rs
Normal file
12
__wasm/wasmtime/wasms/simple_rust_wasm/src/lib.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
#[link(wasm_import_module = "host")]
|
||||
extern "C" {
|
||||
|
||||
#[link_name = "hello"]
|
||||
fn host_hello(a: i32);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn hello() {
|
||||
unsafe { host_hello(3); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user