Add api to get export global instance (#3452)

Add API
```C
bool
wasm_runtime_get_export_global_inst(const wasm_module_inst_t module_inst,
                                    const char *name,
                                    wasm_global_inst_t *global_inst);
```
This commit is contained in:
Benbuck Nason
2024-05-22 01:59:44 -07:00
committed by GitHub
parent 591a20b917
commit c5ab862dbb
2 changed files with 86 additions and 0 deletions

View File

@ -282,6 +282,13 @@ typedef struct wasm_val_t {
} wasm_val_t;
#endif
/* Global instance*/
typedef struct wasm_global_inst_t {
wasm_valkind_t kind;
bool is_mutable;
void *global_data;
} wasm_global_inst_t;
typedef enum {
WASM_LOG_LEVEL_FATAL = 0,
WASM_LOG_LEVEL_ERROR = 1,
@ -1414,6 +1421,21 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_unregister_natives(const char *module_name,
NativeSymbol *native_symbols);
/**
* Get an export global instance
*
* @param module_inst the module instance
* @param name the export global name
* @param global_inst location to store the global instance
*
* @return true if success, false otherwise
*
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_get_export_global_inst(const wasm_module_inst_t module_inst,
const char *name,
wasm_global_inst_t *global_inst);
/**
* Get attachment of native function from execution environment
*