[][src]Function secp256k1_abc_sys::secp256k1_context_set_illegal_callback

pub unsafe extern "C" fn secp256k1_context_set_illegal_callback(
    ctx: *mut secp256k1_context,
    fun: Option<unsafe extern "C" fn(message: *const c_char, data: *mut c_void)>,
    data: *const c_void
)

Set a callback function to be called when an illegal argument is passed to an API call. It will only trigger for violations that are mentioned explicitly in the header.

The philosophy is that these shouldn't be dealt with through a specific return value, as calling code should not have branches to deal with the case that this code itself is broken.

On the other hand, during debug stage, one would want to be informed about such mistakes, and the default (crashing) may be inadvisable. When this callback is triggered, the API function called is guaranteed not to cause a crash, though its return value and output arguments are undefined.

Args: ctx: an existing context object (cannot be NULL) In: fun: a pointer to a function to call when an illegal argument is passed to the API, taking a message and an opaque pointer (NULL restores a default handler that calls abort). data: the opaque pointer to pass to fun above.