From 238f45dddc7f2c57d994a37b06e6d8f7d92c8c21 Mon Sep 17 00:00:00 2001 From: Joe Polny Date: Fri, 31 Oct 2025 03:41:35 -0400 Subject: [PATCH] docs: clarify that * in signatures does address conversion (#4681) docs: clarify that * and $ in signatures does address conversion It was non-obvious that `*` means the runtime does the app to native conversion automatically. With the current docstring, one might assume that the runtime only does boundary checks and not address conversion. Under this assumption, passing the already-native address to `wasm_runtime_addr_app_to_native` will lead to unexpected behavior --- core/iwasm/include/wasm_export.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index 0ab22f711..fc46825c8 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -1740,11 +1740,15 @@ wasm_table_type_get_max_size(const wasm_table_type_t table_type); * 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. + * length of the pointer is 1. The runtime will also convert + * the app pointer to a native pointer, thus there is no need + * to manually call `wasm_runtime_addr_app_to_native`. * '~': 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 + * auto check its boundary before calling the native function. + * Like '*', the runtime will also convert the app pointer to a + * native pointer. * @param n_native_symbols specifies the number of native symbols in the array * * @return true if success, false otherwise