main: SDL_RunApp now explicitly handles NULL argv in all implementations.

It'll usually replace it with `{ "SDL_app", NULL }`, but things like Win32
can query the OS for the original command line arguments.

This allows apps/scripting languages that provide their own entry points to
use SDL_RunApp and not have to worry about how to compose an argv array on
things like Windows, when SDL was going to do it for them anyhow.

Most things won't experience any change with this commit, including apps that
that want extra control but originate in a standard main()-style entry point
and can just pass the existing argc/argv through to SDL_RunApp.

Windows isn't addressed here, since a previous commit already updated it.
GDK has a different fix here, but we'll unify that in a later commit.

Closes #12676.
This commit is contained in:
Ryan C. Gordon
2025-11-21 11:42:04 -05:00
parent ce5e46c37d
commit a37d3f96f4
10 changed files with 85 additions and 58 deletions

View File

@@ -555,6 +555,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetMainReady(void);
* using SDL_main (like when using SDL_MAIN_HANDLED). When using this, you do
* *not* need SDL_SetMainReady().
*
* If `argv` is NULL, SDL will provide command line arguments, either by
* querying the OS for them if possible, or supplying a filler array if not.
*
* \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