From 75ceb0d9e0b8bd97777a0b6443f44b089f0564c2 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 17 Dec 2020 13:56:48 +0100 Subject: [PATCH] fix(c-api) Fix how `wasm_globaltype_t` is implemented. In `wasm.h`, `wasm_globaltype_t` is implemented with `WASM_DECLARE_TYPE`, so with `WASM_DECLARE_VEC(globaltype, *)`. This `*` means the C struct for the vector is defined: ```c struct wasm_globaltype_vec_t { size_t size; wasm_globaltype_t** data; } ``` The way we implement `wasm_globaltype_vec_t` in Rust is with the `wasm_declare_vec!` macro. And it is wrong. We must use `wasm_declared_boxed_vec!`. --- lib/c-api/src/wasm_c_api/types/global.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/c-api/src/wasm_c_api/types/global.rs b/lib/c-api/src/wasm_c_api/types/global.rs index 2195933334c..1b202ad8473 100644 --- a/lib/c-api/src/wasm_c_api/types/global.rs +++ b/lib/c-api/src/wasm_c_api/types/global.rs @@ -46,7 +46,7 @@ impl wasm_globaltype_t { } } -wasm_declare_vec!(globaltype); +wasm_declare_boxed_vec!(globaltype); #[no_mangle] pub unsafe extern "C" fn wasm_globaltype_new(