[−][src]Function wasmer_runtime_c_api::import::wasmer_trap
#[no_mangle] pub unsafe extern "C" fn wasmer_trap(
ctx: *const wasmer_instance_context_t,
error_message: *const c_char
) -> wasmer_result_t
Stop the execution of a host function, aka imported function. The function must be used only inside a host function.
The pointer to wasmer_instance_context_t
is received by the host
function as its first argument. Just passing it to ctx
is fine.
The error message must have a greater lifetime than the host
function itself since the error is read outside the host function
with wasmer_last_error_message
.
This function returns wasmer_result_t::WASMER_ERROR
if ctx
or
error_message
are null.
This function never returns otherwise.