Update wasm_c_api to use vector types (#751)
The WASM C API now requires the use of vector types in certain apis. Switching WAMR to use the new call signatures improves "drop in" compilation compatibility between WAMR and other implementations from a C-api embedding program's perspective. * wasm_func_callback_t type has been updated to use wasm_val_vec_t * wasm_func_callback_with_env_t type has been updated to use wasm_val_vec_t * wasm_func_call() has been updated to use wasm_val_vec_t * wasm_instance_new() has been updated to use wasm_extern_vec_t* * wasm_instance_new_with_args() has been updated to use wasm_extern_vec_t* * wasm_runtime_invoke_c_api_native() has been updated to support vector types in native callbacks without modifying the contract with the interpreter code. * All users of the modified functions (including samples/wasm-c-api/src/*.c) have been appropriately updated.
This commit is contained in:
@ -467,9 +467,9 @@ WASM_API_EXTERN own wasm_module_t* wasm_module_deserialize(wasm_store_t*, const
|
||||
WASM_DECLARE_REF(func)
|
||||
|
||||
typedef own wasm_trap_t* (*wasm_func_callback_t)(
|
||||
const wasm_val_t args[], own wasm_val_t results[]);
|
||||
const wasm_val_vec_t* args, own wasm_val_vec_t *results);
|
||||
typedef own wasm_trap_t* (*wasm_func_callback_with_env_t)(
|
||||
void* env, const wasm_val_t args[], wasm_val_t results[]);
|
||||
void* env, const wasm_val_vec_t *args, wasm_val_vec_t *results);
|
||||
|
||||
WASM_API_EXTERN own wasm_func_t* wasm_func_new(
|
||||
wasm_store_t*, const wasm_functype_t*, wasm_func_callback_t);
|
||||
@ -482,7 +482,7 @@ WASM_API_EXTERN size_t wasm_func_param_arity(const wasm_func_t*);
|
||||
WASM_API_EXTERN size_t wasm_func_result_arity(const wasm_func_t*);
|
||||
|
||||
WASM_API_EXTERN own wasm_trap_t* wasm_func_call(
|
||||
const wasm_func_t*, const wasm_val_t args[], wasm_val_t results[]);
|
||||
const wasm_func_t*, const wasm_val_vec_t* args, wasm_val_vec_t* results);
|
||||
|
||||
|
||||
// Global Instances
|
||||
@ -569,13 +569,13 @@ WASM_API_EXTERN const wasm_memory_t* wasm_extern_as_memory_const(const wasm_exte
|
||||
WASM_DECLARE_REF(instance)
|
||||
|
||||
WASM_API_EXTERN own wasm_instance_t* wasm_instance_new(
|
||||
wasm_store_t*, const wasm_module_t*, const wasm_extern_t *const imports[],
|
||||
wasm_store_t*, const wasm_module_t*, const wasm_extern_vec_t *imports,
|
||||
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[],
|
||||
wasm_store_t*, const wasm_module_t*, const wasm_extern_vec_t *imports,
|
||||
own wasm_trap_t**, const uint32_t stack_size, const uint32_t heap_size
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user