Update WebAssembly C API submodule to latest commit. (#2579)
* Update WebAssembly C API submodule to latest commit. This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes #2211. Fixes #2131. * Update Doxygen comments for wasm.h changes.
This commit is contained in:
@@ -26,7 +26,7 @@ to tweak the `-lpthread` and such annotations as well as the name of the
|
||||
|
||||
static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
|
||||
|
||||
static wasm_trap_t* hello_callback(const wasm_val_t args[], wasm_val_t results[]) {
|
||||
static wasm_trap_t* hello_callback(const wasm_val_vec_t* args, wasm_val_vec_t* results) {
|
||||
printf("Calling back...\n");
|
||||
printf("> Hello World!\n");
|
||||
return NULL;
|
||||
@@ -111,8 +111,9 @@ int deserialize(wasm_byte_vec_t* buffer) {
|
||||
printf("Instantiating module...\n");
|
||||
wasm_trap_t *trap = NULL;
|
||||
wasm_instance_t *instance = NULL;
|
||||
const wasm_extern_t *imports[] = { wasm_func_as_extern(hello) };
|
||||
error = wasmtime_instance_new(store, module, imports, 1, &instance, &trap);
|
||||
wasm_extern_t *imports[] = { wasm_func_as_extern(hello) };
|
||||
wasm_extern_vec_t imports_vec = WASM_ARRAY_VEC(imports);
|
||||
error = wasmtime_instance_new(store, module, &imports_vec, &instance, &trap);
|
||||
if (instance == NULL)
|
||||
exit_with_error("failed to instantiate", error, trap);
|
||||
|
||||
@@ -126,7 +127,9 @@ int deserialize(wasm_byte_vec_t* buffer) {
|
||||
|
||||
// And call it!
|
||||
printf("Calling export...\n");
|
||||
error = wasmtime_func_call(run, NULL, 0, NULL, 0, &trap);
|
||||
wasm_val_vec_t args_vec = WASM_EMPTY_VEC;
|
||||
wasm_val_vec_t results_vec = WASM_EMPTY_VEC;
|
||||
error = wasmtime_func_call(run, &args_vec, &results_vec, &trap);
|
||||
if (error != NULL || trap != NULL)
|
||||
exit_with_error("failed to call function", error, trap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user