What Happens If We Call An SDL2 Function That Is Not Present In The SDL2 Being Used?

Hi,

Using SDL2 in a game project for both Windows and Linux
We want to use new SDL 2.0.14.

On Windows platform the above has no issues.
But on Linux, the user might not have SDL 2.0.14.

If we call a new function in SDL 2.0.14
and the user is using an older SDL2 what will happen?
Will the game crash?

Little confused, please clarify.
Thanks!

Jesse

and the user is using an older SDL2 what will happen?

What will always happen: your program will fail to load. Like this, for example:
./a.out: symbol lookup error: ./a.out: undefined symbol: SDL_wcscasecmp

What do you want to happen? If you want to call the new function when it’s available, but ignore it (or use a workaround) when it’s not, then use late binding for that function. That is, call SDL_LoadObject() to load the shared object and SDL_LoadFunction() to get a pointer to that function, if it exists.

#if SDL_VERSION_ATLEAST(2,0,14)
…code…
#endif

#if SDL_VERSION_ATLEAST(2,0,14)

That would require the end-user to compile the application from source. I assume the OP wants to build and distribute a binary, hence the run-time solution.

You are right, sorry