SDL School

API reference / Application

SDL_AppQuit

Function, SDL3

You write this function, and SDL calls it one time at the end of the program. Free your own resources here.

Declaration

#include <SDL3/SDL.h>

void SDL_AppQuit(void *appstate, SDL_AppResult result);

Parameters

appstateThe pointer that you stored in SDL_AppInit.
resultThe reason that the program is ending.

Example

Load an image
void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
    SDL_DestroyTexture(ship);
}

See this code run in Load an image. Download the full program (.zip)

Notes

In SDL2

SDL2 has no main callbacks. You put the cleanup at the end of main, and you call SDL_Quit.

See also