sdlRunApp function
- int argc,
- Pointer<
Pointer< argv,Int8> > - Pointer<
NativeFunction< mainFunction,SdlMainFunc> > - Pointer<
NativeType> reserved,
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().
\param argc the argc parameter from the application's main() function, or 0
if the platform's main-equivalent has no argc.
\param argv the argv parameter from the application's main() function, or
NULL if the platform's main-equivalent has no argv.
\param mainFunction your SDL app's C-style main(). NOT the function you're
calling this from! Its name doesn't matter; it doesn't
literally have to be main
.
\param reserved should be NULL (reserved for future use, will probably be
platform-specific then).
\returns the return value from mainFunction: 0 on success, otherwise
failure; SDL_GetError() might have more information on the
failure.
\threadsafety Generally this is called once, near startup, from the process's initial thread.
\since This function is available since SDL 3.1.3.
extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void *reserved)
Implementation
int sdlRunApp(
int argc,
Pointer<Pointer<Int8>> argv,
Pointer<NativeFunction<SdlMainFunc>> mainFunction,
Pointer<NativeType> reserved) {
final sdlRunAppLookupFunction = libSdl3.lookupFunction<
Int32 Function(
Int32 argc,
Pointer<Pointer<Int8>> argv,
Pointer<NativeFunction<SdlMainFunc>> mainFunction,
Pointer<NativeType> reserved),
int Function(
int argc,
Pointer<Pointer<Int8>> argv,
Pointer<NativeFunction<SdlMainFunc>> mainFunction,
Pointer<NativeType> reserved)>('SDL_RunApp');
return sdlRunAppLookupFunction(argc, argv, mainFunction, reserved);
}