Plan to add several APIs to support the name of a WASMModule. People can set it and get it. A rough idea will be
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_set_module_name(wasm_module_t module, const char *name,
char *error_buf, uint32_t error_buf_size);
/* return the most recently set module name or "" if never set before */
WASM_RUNTIME_API_EXTERN const char*
wasm_runtime_get_module_name(wasm_module_t module);
Another choice about set_module_name is adding an extra parameter to wasm_runtime_load(), like wasm_runtime_load(uint8_t*,uint32_t,const char*,...). Drop it because it feels not right to change an existed and widely used API, especially when there is another way.
Those APIs will not do any additional protections from sharing same names in WASMModules, or repeatedly set names to one same WASMModule and so on. Basically, we let callers to handle those situations.
The name will be stored in const_str_list to save memory consumption.
Plan to add several APIs to support the name of a
WASMModule
. People can set it and get it. A rough idea will beAnother choice about set_module_name is adding an extra parameter to
wasm_runtime_load()
, likewasm_runtime_load(uint8_t*,uint32_t,const char*,...)
. Drop it because it feels not right to change an existed and widely used API, especially when there is another way.Those APIs will not do any additional protections from sharing same names in
WASMModule
s, or repeatedly set names to one sameWASMModule
and so on. Basically, we let callers to handle those situations.The name will be stored in
const_str_list
to save memory consumption.