Implement apis to set and get the name of a wasm module (#3254)

Add API wasm_runtime_set_module_name and wasm_runtime_get_module_name,
and by default, a module's name is "" if the set module name api isn't called.
This commit is contained in:
liang.he
2024-03-26 12:10:13 +08:00
committed by GitHub
parent ca364eb5d7
commit d8d8f8ce04
14 changed files with 367 additions and 322 deletions

View File

@ -307,6 +307,9 @@ typedef struct AOTModule {
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
WASMCustomSection *custom_section_list;
#endif
/* user defined name */
char *name;
} AOTModule;
#define AOTMemoryInstance WASMMemoryInstance
@ -761,6 +764,20 @@ bool
aot_traverse_gc_rootset(WASMExecEnv *exec_env, void *heap);
#endif /* end of WASM_ENABLE_GC != 0 */
char *
aot_const_str_set_insert(const uint8 *str, int32 len, AOTModule *module,
#if (WASM_ENABLE_WORD_ALIGN_READ != 0)
bool is_vram_word_align,
#endif
char *error_buf, uint32 error_buf_size);
bool
aot_set_module_name(AOTModule *module, const char *name, char *error_buf,
uint32_t error_buf_size);
const char *
aot_get_module_name(AOTModule *module);
#ifdef __cplusplus
} /* end of extern "C" */
#endif