logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_main - An app-supplied function for program entry.

Availability

       This function is available since SDL 3.2.0.

Simple Directmedia Layer                           SDL 3.2.10                                        SDL_main(3)

Description

       Apps do not directly create this function; they should create a standard ANSI-C main function instead. If
       SDL needs to insert some startup code before main runs, or the platform doesn't actually _use_ a function
       called "main", SDL will do some macro magic to redefine main to

       SDL_main and provide its own main .

       Apps  should  include  SDL_main.h  in  the same file as their main function, and they should not use that
       symbol for anything else in that file, as it might get redefined.

       This function is only provided by the app if it isn't using

       SDL_MAIN_USE_CALLBACKS .

       Program  startup  is  a  surprisingly  complex  topic.  Please  see  [README/main-functions](README/main-
       functions), (or docs/README-main-functions.md in the source tree) for a more detailed explanation.

Function Parameters

argc   an ANSI-C style main function's argc.

       argv   an ANSI-C style main function's argv.

Header File

       Defined in SDL3/SDL_main.h

Name

       SDL_main - An app-supplied function for program entry.

Return Value

       Returns  an  ANSI-C  main return code; generally 0 is considered successful program completion, and small
       non-zero values are considered errors.

Synopsis

#include"SDL3/SDL.h"intSDL_main(intargc,char*argv[]);

Thread Safety

       This is the program entry point.

See Also