---
name: "SDL_SetAssertionHandler"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SetAssertionHandler"
---

# SDL\_SetAssertionHandler(3)

Set an application-defined assertion handler.

## NAME

SDL\_SetAssertionHandler - Set an application-defined assertion handler.

## HEADER FILE

Defined in SDL3/SDL\_assert.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**void SDL\_SetAssertionHandler(**                 **SDL\_AssertionHandler handler,**                 **void \*userdata);**

## DESCRIPTION

This function allows an application to show its own assertion UI and/or force the response to an assertion failure. If the application doesn't provide this, SDL will try to do the right thing, popping up a system-specific GUI dialog, and probably minimizing any fullscreen windows.

This callback may fire from any thread, but it runs wrapped in a mutex, so it will only fire from one thread at a time.

This callback is NOT reset to SDL's internal handler upon

**SDL\_Quit** ()!

## FUNCTION PARAMETERS

- *handler*

  the  **SDL\_AssertionHandler**\
    function to call when an assertion fails or NULL for the default handler.

- *userdata*

  a pointer that is passed to **handler** .

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetAssertionHandler**(3)](/SDL_GetAssertionHandler/3.md)
