SDL 3.0
|
Redefine main() on some platforms so that it is called by SDL. More...
Go to the source code of this file.
Macros | |
#define | SDLMAIN_DECLSPEC |
Typedefs | |
typedef int(* | SDL_main_func) (int argc, char *argv[]) |
Functions | |
SDLMAIN_DECLSPEC int | SDL_main (int argc, char *argv[]) |
void | SDL_SetMainReady (void) |
int | SDL_RunApp (int argc, char *argv[], SDL_main_func mainFunction, void *reserved) |
Redefine main() on some platforms so that it is called by SDL.
The application's main() function must be called with C linkage, and should be declared like this:
Definition in file SDL_main.h.
#define SDLMAIN_DECLSPEC |
Definition at line 125 of file SDL_main.h.
typedef int(* SDL_main_func) (int argc, char *argv[]) |
The prototype for the application's main() function
Definition at line 155 of file SDL_main.h.
|
extern |
Referenced by main().
|
extern |
Initializes and launches an SDL application, by doing platform-specific initialization before calling your mainFunction and cleanups after it returns, if that is needed for a specific platform, otherwise it just calls mainFunction.
You can use this if you want to use your own main() implementation without using SDL_main (like when using SDL_MAIN_HANDLED). When using this, you do not need SDL_SetMainReady().
argc | The argc parameter from the application's main() function, or 0 if the platform's main-equivalent has no argc |
argv | The argv parameter from the application's main() function, or NULL if the platform's main-equivalent has no argv |
mainFunction | Your SDL app's C-style main(), an SDL_main_func. NOT the function you're calling this from! Its name doesn't matter, but its signature must be like int my_main(int argc, char* argv[]) |
reserved | should be NULL (reserved for future use, will probably be platform-specific then) |
Referenced by main().
|
extern |
Circumvent failure of SDL_Init() when not using SDL_main() as an entry point.
This function is defined in SDL_main.h, along with the preprocessor rule to redefine main() as SDL_main(). Thus to ensure that your main() function will not be changed it is necessary to define SDL_MAIN_HANDLED before including SDL.h.