The new callback, or null to remove the currently set callback.
The previously set callback, or null if no callback was set.
@callback_signature
void callback_name(int error_code, const char* description)
For more information about the callback parameters, see the callback pointer type.
Errors: None.
@remark This function may be called before @ref glfwInit.
This function must only be called from the main thread.
@sa @ref error_handling @sa @ref glfwGetError
Added in version 3.0.
Ingroup: init
Sets the error callback.
This function sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.
The error code is set before the callback is called. Calling @ref glfwGetError from the error callback will return the same value as the error code argument.
The error callback is called on the thread where the error occurred. If you are using GLFW from multiple threads, your error callback needs to be written accordingly.
Because the description string may have been generated specifically for that error, it is not guaranteed to be valid after the callback has returned. If you wish to use it after the callback returns, you need to make a copy.
Once set, the error callback remains set even after the library has been terminated.