From e10ad512bcdcac420d0f1206b48e33aae0833c75 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 17 Dec 2020 13:51:41 +0100 Subject: [PATCH] fix(c-api) Fix how `wasm_functype_t` is implemented. In `wasm.h`, `wasm_functype_t` is implemented with `WASM_DECLARE_TYPE`, so with `WASM_DECLARE_VEC(functype, *)`. This `*` means the C struct for the vector is defined: ```c struct wasm_functype_vec_t { size_t size; wasm_functype_t** data; } ``` The way we implement `wasm_functype_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/function.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/c-api/src/wasm_c_api/types/function.rs b/lib/c-api/src/wasm_c_api/types/function.rs index 35b845481d6..cf8cfeaa347 100644 --- a/lib/c-api/src/wasm_c_api/types/function.rs +++ b/lib/c-api/src/wasm_c_api/types/function.rs @@ -90,7 +90,7 @@ impl wasm_functype_t { } } -wasm_declare_vec!(functype); +wasm_declare_boxed_vec!(functype); #[no_mangle] pub unsafe extern "C" fn wasm_functype_new(