wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Compiler complains about the const pointer being written to.
trafficstars
https://github.com/bytecodealliance/wasm-micro-runtime/blob/7affac0ed35d7feec1cbe20f443248027b764435/core/iwasm/common/wasm_c_api.c#L2360
wasm_module_t *
wasm_module_new(wasm_store_t *store, const wasm_byte_vec_t *binary)
{
LoadArgs args = { 0 };
args.name = "";
args.clone_wasm_binary = true;
return wasm_module_new_ex(store, (wasm_byte_vec_t *)binary, &args);
}
Can we construct the name, true and ??? values for LoadArgs to avoid this error?
Like LoadArgs args = { };
Here's an example of the compiler warning.
wasm-micro-runtime/core/iwasm/common/wasm_runtime_common.c:1399:15: error: assigning to 'char *' from 'const char[1]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
args.name = "";
^ ~~
Hi, can you try the following conversion? Like
args.name = (char *)"";