Function gifski::c_api::gifski_set_error_message_callback
source · #[no_mangle]
pub unsafe extern "C" fn gifski_set_error_message_callback(
handle: *const GifskiHandle,
cb: unsafe extern "C" fn(_: *const c_char, _: *mut c_void),
user_data: *mut c_void
) -> GifskiError
Expand description
Get a callback when an error occurs. This is intended mostly for logging and debugging, not for user interface.
The callback function has the following arguments:
- A
\0
-terminated C string in UTF-8 encoding. The string is only valid for the duration of the call. Make a copy if you need to keep it. - An arbitrary pointer (
user_data
).user_data
can beNULL
.
The callback must be thread-safe (it will be called from another thread).
It must remain valid at all times, until gifski_finish
completes.
If the callback is not set, errors will be printed to stderr.
This function must be called before gifski_set_file_output()
to take effect.