diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2026-08-23 13:40:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-23 13:40:38 +0200 |
| commit | 951c8070169e8bd970940029156f305e741aecdb (patch) | |
| tree | fbf012a24cbd380b689958122e7f66a2a85d23e1 /examples/rust/src/tinywasm_precompiled.rs | |
| parent | 358a183e5c12c32b8836acf9c71799f56e00b036 (diff) | |
chore: remove LinearMemory trait (#53)
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'examples/rust/src/tinywasm_precompiled.rs')
| -rw-r--r-- | examples/rust/src/tinywasm_precompiled.rs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/rust/src/tinywasm_precompiled.rs b/examples/rust/src/tinywasm_precompiled.rs deleted file mode 100644 index bc0e0c1..0000000 --- a/examples/rust/src/tinywasm_precompiled.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![no_main] -use tinywasm::{FuncContext, HostFunction, Module, ModuleInstance}; - -#[link(wasm_import_module = "env")] -unsafe extern "C" { - fn printi32(x: i32); -} - -#[unsafe(no_mangle)] -pub extern "C" fn hello() { - let _ = run(); -} - -fn run() -> tinywasm::Result<()> { - let module = Module::try_from_twasm(include_bytes!("./print.twasm"))?; - let mut store = tinywasm::Store::default(); - - let printi32 = HostFunction::from(|_: FuncContext<'_>, v: i32| { - unsafe { printi32(v) } - Ok(()) - }); - - let mut imports = tinywasm::Imports::new(); - imports.define("env", "printi32", printi32); - - let instance = ModuleInstance::instantiate(&mut store, &module, Some(&imports))?; - let add_and_print = instance.func::<(i32, i32), ()>(&store, "add_and_print")?; - add_and_print.call(&mut store, (1, 2))?; - Ok(()) -} |
