mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 05:38:19 +00:00
fix(c-api) Fix how wasm_memorytype_t is implemented.
In `wasm.h`, `wasm_memorytype_t` is implemented with
`WASM_DECLARE_TYPE`, so with `WASM_DECLARE_VEC(memorytype, *)`. This
`*` means the C struct for the vector is defined:
```c
struct wasm_memorytype_vec_t {
size_t size;
wasm_memorytype_t** data;
}
```
The way we implement `wasm_memorytype_vec_t` in Rust is with the
`wasm_declare_vec!` macro. And it is wrong. We must use
`wasm_declared_boxed_vec!`.
This commit is contained in:
@@ -48,7 +48,7 @@ impl wasm_memorytype_t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wasm_declare_vec!(memorytype);
|
wasm_declare_boxed_vec!(memorytype);
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasm_memorytype_new(limits: &wasm_limits_t) -> Box<wasm_memorytype_t> {
|
pub unsafe extern "C" fn wasm_memorytype_new(limits: &wasm_limits_t) -> Box<wasm_memorytype_t> {
|
||||||
|
|||||||
Reference in New Issue
Block a user