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:
@@ -50,8 +50,6 @@ WASMTIME_CONFIG_PROP(profiler, wasmtime_profiling_strategy_t)
|
||||
|
||||
// Converts from the text format of WebAssembly to to the binary format.
|
||||
//
|
||||
// * `engine` - a previously created engine which will drive allocations and
|
||||
// such
|
||||
// * `wat` - this it the input buffer with the WebAssembly Text Format inside of
|
||||
// it. This will be parsed and converted to the binary format.
|
||||
// * `ret` - if the conversion is successful, this byte vector is filled in with
|
||||
@@ -62,7 +60,6 @@ WASMTIME_CONFIG_PROP(profiler, wasmtime_profiling_strategy_t)
|
||||
//
|
||||
// Returns `true` if conversion succeeded, or `false` if it failed.
|
||||
WASM_API_EXTERN bool wasmtime_wat2wasm(
|
||||
wasm_engine_t *engine,
|
||||
const wasm_byte_vec_t *wat,
|
||||
own wasm_byte_vec_t *ret,
|
||||
own wasm_byte_vec_t *error_message
|
||||
@@ -75,7 +72,7 @@ WASM_API_EXTERN bool wasmtime_wat2wasm(
|
||||
|
||||
WASMTIME_DECLARE_OWN(linker)
|
||||
|
||||
WASM_API_EXTERN own wasmtime_linker_t* wasmtime_linker_new(wasm_store_t* store);
|
||||
WASM_API_EXTERN own wasmtime_linker_t* wasmtime_linker_new(wasm_store_t* store, bool allow_shadowing);
|
||||
|
||||
WASM_API_EXTERN bool wasmtime_linker_define(
|
||||
wasmtime_linker_t *linker,
|
||||
@@ -101,6 +98,14 @@ WASM_API_EXTERN wasm_instance_t* wasmtime_linker_instantiate(
|
||||
own wasm_trap_t **trap
|
||||
);
|
||||
|
||||
typedef struct wasmtime_caller_t wasmtime_caller_t;
|
||||
|
||||
typedef own wasm_trap_t* (*wasmtime_func_callback_t)(const wasmtime_caller_t* caller, const wasm_val_t args[], wasm_val_t results[]);
|
||||
|
||||
WASM_API_EXTERN own wasm_func_t* wasmtime_func_new(wasm_store_t*, const wasm_functype_t*, wasmtime_func_callback_t callback);
|
||||
|
||||
WASM_API_EXTERN own wasm_extern_t* wasmtime_caller_export_get(const wasmtime_caller_t* caller, const wasm_name_t* name);
|
||||
|
||||
#undef own
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user