Improve wasm-c-api instantiation-time linking (#1902)
Add APIs to help prepare the imports for the wasm-c-api `wasm_instance_new`: - wasm_importtype_is_linked - wasm_runtime_is_import_func_linked - wasm_runtime_is_import_global_linked - wasm_extern_new_empty For wasm-c-api, developer may use `wasm_module_imports` to get the import types info, check whether an import func/global is linked with the above API, and ignore the linking of an import func/global with `wasm_extern_new_empty`. Sample `wasm-c-api-import` is added and document is updated.
This commit is contained in:
@ -354,6 +354,7 @@ WASM_API_EXTERN own wasm_importtype_t* wasm_importtype_new(
|
||||
WASM_API_EXTERN const wasm_name_t* wasm_importtype_module(const wasm_importtype_t*);
|
||||
WASM_API_EXTERN const wasm_name_t* wasm_importtype_name(const wasm_importtype_t*);
|
||||
WASM_API_EXTERN const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t*);
|
||||
WASM_API_EXTERN bool wasm_importtype_is_linked(const wasm_importtype_t*);
|
||||
|
||||
|
||||
// Export Types
|
||||
@ -797,6 +798,9 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
|
||||
|
||||
#define KILOBYTE(n) ((n) * 1024)
|
||||
|
||||
// Create placeholders filled in `wasm_externvec_t* imports` for `wasm_instance_new()`
|
||||
WASM_API_EXTERN wasm_extern_t *wasm_extern_new_empty(wasm_store_t *, wasm_externkind_t);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#undef own
|
||||
|
||||
Reference in New Issue
Block a user