args_sizes_get()
Return command-line argument data sizes.
Description
The args_sizes_get()
function is used to retrieve the sizes of the command-line argument data provided to the WebAssembly module. The sizes are written to the specified output pointers.
Syntax
;;; Return command-line argument data sizes.
(@interface func (export "args_sizes_get")
(param $argc (@witx pointer (@witx pointer u32)))
(param $argv_buf_size (@witx pointer (@witx pointer u32)))
;;; Returns the number of arguments and the size of the argument string
;;; data, or an error.
(result $error (expected (tuple $size $size) (error $errno)))
)
Parameters
ctx
: A mutable reference to the function environment.argc
: A WebAssembly pointer to a memory location where the number of arguments will be written.argv_buf_size
: A WebAssembly pointer to a memory location where the size of the argument string data will be written.
Return Value
The function returns an Errno
value indicating the success or failure of the operation.
Logging
This function has been instrumented with debug-level logging. It will log the following information:
argc
: The number of arguments.argv_buf_size
: The size of the argument string data.
Please make sure the logging configuration is properly set up to capture the desired logs.
Note
The args_sizes_get()
function returns the sizes of the command-line argument data provided to the WebAssembly module. The number of arguments and the size of the argument string data are written to the specified memory locations.