Skip to content

Commit 238f45d

Browse files
authored
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
1 parent b08b02a commit 238f45d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/iwasm/include/wasm_export.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,11 +1740,15 @@ wasm_table_type_get_max_size(const wasm_table_type_t table_type);
17401740
* auto check its boundary before calling the native function.
17411741
* If it is followed by '~', the checked length of the pointer
17421742
* is gotten from the following parameter, if not, the checked
1743-
* length of the pointer is 1.
1743+
* length of the pointer is 1. The runtime will also convert
1744+
* the app pointer to a native pointer, thus there is no need
1745+
* to manually call `wasm_runtime_addr_app_to_native`.
17441746
* '~': the parameter is the pointer's length with i32 type, and must
17451747
* follow after '*'
17461748
* '$': the parameter is a string (i32 in WASM), and runtime will
1747-
* auto check its boundary before calling the native function
1749+
* auto check its boundary before calling the native function.
1750+
* Like '*', the runtime will also convert the app pointer to a
1751+
* native pointer.
17481752
* @param n_native_symbols specifies the number of native symbols in the array
17491753
*
17501754
* @return true if success, false otherwise

0 commit comments

Comments
 (0)