Implement most missing wasm-c-api APIs (#303) (#676)

Remove unnecessary functions and implement more APIs:
- wasm_##name##same
- wasm##name##as_ref
- wasm_ref_as##name##
- wasm_ref_delete
- wasm_module_validate
- wasm_table_get/set/size
- wasm_memory_size
- wasm_config_new
- wasm_foreign_new

And add more wasm-c-api samples, update the related documen, add more CI rules.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-07-28 21:53:37 +08:00
committed by GitHub
parent 4193949ef5
commit edb184f709
24 changed files with 1872 additions and 450 deletions

View File

@ -573,6 +573,12 @@ WASM_API_EXTERN own wasm_instance_t* wasm_instance_new(
own wasm_trap_t**
);
// please refer to wasm_runtime_instantiate(...) in core/iwasm/include/wasm_export.h
WASM_API_EXTERN own wasm_instance_t* wasm_instance_new_with_args(
wasm_store_t*, const wasm_module_t*, const wasm_extern_t *const imports[],
own wasm_trap_t**, const uint32_t stack_size, const uint32_t heap_size
);
WASM_API_EXTERN void wasm_instance_exports(const wasm_instance_t*, own wasm_extern_vec_t* out);
@ -764,6 +770,7 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .of = {.ref = r}}
#define WASM_INIT_VAL {.kind = WASM_ANYREF, .of = {.ref = NULL}}
#define KILOBYTE(n) ((n) * 1024)
///////////////////////////////////////////////////////////////////////////////