wasmtime_func_unchecked_callback_t typedef

wasmtime_func_unchecked_callback_t = Pointer<NativeFunction<wasmtime_func_unchecked_callback_tFunction>>

\brief Callback signature for #wasmtime_func_new_unchecked.

This is the function signature for host functions that can be made accessible to WebAssembly. The arguments to this function are:

\param env user-provided argument passed to #wasmtime_func_new_unchecked \param caller a temporary object that can only be used during this function call. Used to acquire #wasmtime_context_t or caller's state \param args_and_results storage space for both the parameters to the function as well as the results of the function. The size of this array depends on the function type that the host function is created with, but it will be the maximum of the number of parameters and number of results. \param num_args_and_results the size of the args_and_results parameter in units of #wasmtime_val_raw_t.

This callback can optionally return a #wasm_trap_t indicating that a trap should be raised in WebAssembly. It's expected that in this case the caller relinquishes ownership of the trap and it is passed back to the engine.

This differs from #wasmtime_func_callback_t in that the payload of args_and_results does not have type information, nor does it have sizing information. This is especially unsafe because it's only valid within the particular #wasm_functype_t that the function was created with. The onus is on the embedder to ensure that args_and_results are all read correctly for parameters and all written for results within the execution of a function.

Parameters will be listed starting at index 0 in the args_and_results array. Results are also written starting at index 0, which will overwrite the arguments.

Implementation

typedef wasmtime_func_unchecked_callback_t =
    ffi.Pointer<ffi.NativeFunction<wasmtime_func_unchecked_callback_tFunction>>;