pub unsafe extern "C" fn wasm_runtime_register_natives(
module_name: *const c_char,
native_symbols: *mut NativeSymbol,
n_native_symbols: u32,
) -> boolExpand description
Register native functions with same module name
Note: The array native_symbols should not be read-only because the
library can modify it in-place.
Note: After successful call of this function, the array native_symbols
is owned by the library.
@param module_name the module name of the native functions
@param native_symbols specifies an array of NativeSymbol structures which
contain the names, function pointers and signatures
Note: WASM runtime will not allocate memory to clone the data, so
user must ensure the array can be used forever
Meanings of letters in function signature:
‘i’: the parameter is i32 type
‘I’: the parameter is i64 type
‘f’: the parameter is f32 type
‘F’: the parameter is f64 type
‘r’: the parameter is externref type, it should be a uintptr_t
in host
‘’: the parameter is a pointer (i32 in WASM), and runtime will
auto check its boundary before calling the native function.
If it is followed by ‘’, the checked length of the pointer
is gotten from the following parameter, if not, the checked
length of the pointer is 1.
‘’: the parameter is the pointer’s length with i32 type, and must
follow after ‘’
‘$’: the parameter is a string (i32 in WASM), and runtime will
auto check its boundary before calling the native function
@param n_native_symbols specifies the number of native symbols in the array
@return true if success, false otherwise