#[no_mangle]
pub unsafe extern "C" fn wasmer_last_error_message(
buffer: Option<NonNull<c_char>>,
length: c_int,
) -> c_intExpand description
Gets the last error message if any into the provided buffer
buffer up to the given length.
The length parameter must be large enough to store the last
error message. Ideally, the value should come from
wasmer_last_error_length.
The function returns the length of the string in bytes, -1 if an
error occurs. Potential errors are:
- The
bufferis a null pointer, - The
bufferis too small to hold the error message.
Note: The error message always has a trailing NUL character.
Important note: If the provided buffer is non-null, once this
function has been called, regardless whether it fails or succeeds,
the error is cleared.
§Example
See this module’s documentation to get a complete example.