Reimplement the C# API.

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.
This commit is contained in:
Peter Huene
2020-03-24 18:20:22 -07:00
parent 0d5d63fdb1
commit cf1d9ee857
38 changed files with 2149 additions and 2213 deletions

View File

@@ -1,20 +1,24 @@
(module
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$v (func))
(import "env" "add" (func $add (param i32 i32) (result i32)))
(import "env" "do_throw" (func $do_throw))
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "add_wrapper" (func $add_wrapper))
(export "do_throw_wrapper" (func $do_throw_wrapper))
(func $add_wrapper (; 2 ;) (param $0 i32) (param $1 i32) (result i32)
(call $add
(get_local $0)
(get_local $1)
)
(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 $do_throw_wrapper (; 3 ;)
(call $do_throw)
(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")
)