This commit reimplements the C# API in terms of a Wasmtime linker. It removes the custom binding implementation that was based on reflection in favor of the linker's implementation. This should make the C# API a little closer to the Rust API. The `Engine` and `Store` types have been hidden behind the `Host` type which is responsible for hosting WebAssembly module instances. Documentation and tests have been updated.
25 lines
784 B
Plaintext
25 lines
784 B
Plaintext
(module
|
|
(import "env" "add" (func $env.add (param i32 i32) (result i32)))
|
|
(import "env" "swap" (func $env.swap (param i32 i32) (result i32 i32)))
|
|
(import "env" "do_throw" (func $env.do_throw))
|
|
(import "env" "check_string" (func $env.check_string (param i32 i32)))
|
|
(memory (export "mem") 1)
|
|
(export "add" (func $add))
|
|
(export "swap" (func $swap))
|
|
(export "do_throw" (func $do_throw))
|
|
(export "check_string" (func $check_string))
|
|
(func $add (param i32 i32) (result i32)
|
|
(call $env.add (local.get 0) (local.get 1))
|
|
)
|
|
(func $swap (param i32 i32) (result i32 i32)
|
|
(call $env.swap (local.get 0) (local.get 1))
|
|
)
|
|
(func $do_throw
|
|
(call $env.do_throw)
|
|
)
|
|
(func $check_string
|
|
(call $env.check_string (i32.const 0) (i32.const 11))
|
|
)
|
|
(data (i32.const 0) "Hello World")
|
|
)
|