sdl2-compat: make sure all SDL2 public functions are prototyped before defined:

From 521449ff63e45545b3fc6a1c5eab2ee78567076b Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 3 Mar 2023 01:55:50 +0300
Subject: [PATCH] make sure all SDL2 public functions are prototyped before
 defined:

- include sdl2_protos.h, which is derived from SDL_dynapi_procs.h.
---
 src/sdl2_compat.c |   9 +-
 src/sdl2_protos.h | 970 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 975 insertions(+), 4 deletions(-)
 create mode 100644 src/sdl2_protos.h

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index df2b908..2a296aa 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -101,10 +101,15 @@ This breaks the build when creating SDL_ ## DisableScreenSaver
 #define SDL2COMPAT_MAXPATH 1024
 #endif
 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* SDL2 function prototypes:  */
+#include "sdl2_protos.h"
+
+
 /** Enable this to have warnings about wrong prototypes of src/sdl3_sym.h
  *  It won't compile but it helps to make sure it's sync'ed with SDL3 headers.
  */
@@ -366,10 +371,6 @@ SDL2Compat_GetHintBoolean(const char *name, SDL_bool default_value)
 }
 
 
-/* Forward declarations */
-DECLSPEC int SDLCALL SDL_NumJoysticks(void);
-
-
 /* if you change this, update also SDL2Compat_ApplyQuirks() */
 static const char *
 SDL2_to_SDL3_hint(const char *name)
diff --git a/src/sdl2_protos.h b/src/sdl2_protos.h
new file mode 100644
index 0000000..7ddc88d
--- /dev/null
+++ b/src/sdl2_protos.h
@@ -0,0 +1,970 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef sdl2_protos_h
+#define sdl2_protos_h 1
+
+#define SDL2_PROTO(rc,fn,params) \
+ extern DECLSPEC rc SDLCALL SDL_##fn params ;
+
+SDL2_PROTO(int,SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...))
+SDL2_PROTO(void,Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...))
+SDL2_PROTO(void,LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogInfo,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogWarn,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogError,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogCritical,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(void,LogMessage,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, ...))
+SDL2_PROTO(int,sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...))
+SDL2_PROTO(int,snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...))
+
+#if defined(__WIN32__) || defined(__GDK__)
+SDL2_PROTO(SDL_Thread*,CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e))
+#elif defined(__OS2__)
+SDL2_PROTO(SDL_Thread*,CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e))
+#else
+SDL2_PROTO(SDL_Thread*,CreateThread,(SDL_ThreadFunction a, const char *b, void *c))
+#endif
+
+#ifdef HAVE_STDIO_H
+SDL2_PROTO(SDL2_RWops*,RWFromFP,(FILE *a, SDL_bool b))
+#else
+SDL2_PROTO(SDL2_RWops*,RWFromFP,(void *a, SDL_bool b))
+#endif
+
+#if defined(__WIN32__) || defined(__GDK__)
+SDL2_PROTO(int,RegisterApp,(const char *a, Uint32 b, void *c))
+SDL2_PROTO(void,UnregisterApp,(void))
+#endif
+
+#if defined(__WIN32__) || defined(__WINGDK__)
+SDL2_PROTO(int,Direct3D9GetAdapterIndex,(int a))
+SDL2_PROTO(IDirect3DDevice9*,RenderGetD3D9Device,(SDL_Renderer *a))
+#endif
+
+#ifdef __IOS__
+SDL2_PROTO(int,iPhoneSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *))
+SDL2_PROTO(void,iPhoneSetEventPump,(SDL_bool a))
+#endif
+
+#ifdef __ANDROID__
+SDL2_PROTO(void*,AndroidGetJNIEnv,(void))
+SDL2_PROTO(void*,AndroidGetActivity,(void))
+SDL2_PROTO(const char*,AndroidGetInternalStoragePath,(void))
+SDL2_PROTO(int,AndroidGetExternalStorageState,(void))
+SDL2_PROTO(const char*,AndroidGetExternalStoragePath,(void))
+#endif
+
+SDL2_PROTO(int,Init,(Uint32 a))
+SDL2_PROTO(int,InitSubSystem,(Uint32 a))
+SDL2_PROTO(void,QuitSubSystem,(Uint32 a))
+SDL2_PROTO(Uint32,WasInit,(Uint32 a))
+SDL2_PROTO(void,Quit,(void))
+SDL2_PROTO(SDL_AssertState,ReportAssertion,(SDL_AssertData *a, const char *b, const char *c, int d))
+SDL2_PROTO(void,SetAssertionHandler,(SDL_AssertionHandler a, void *b))
+SDL2_PROTO(const SDL_AssertData*,GetAssertionReport,(void))
+SDL2_PROTO(void,ResetAssertionReport,(void))
+SDL2_PROTO(SDL_bool,AtomicTryLock,(SDL_SpinLock *a))
+SDL2_PROTO(void,AtomicLock,(SDL_SpinLock *a))
+SDL2_PROTO(void,AtomicUnlock,(SDL_SpinLock *a))
+SDL2_PROTO(SDL_bool,AtomicCAS,(SDL_atomic_t *a, int b, int c))
+SDL2_PROTO(int,AtomicSet,(SDL_atomic_t *a, int b))
+SDL2_PROTO(int,AtomicGet,(SDL_atomic_t *a))
+SDL2_PROTO(int,AtomicAdd,(SDL_atomic_t *a, int b))
+SDL2_PROTO(SDL_bool,AtomicCASPtr,(void **a, void *b, void *c))
+SDL2_PROTO(void*,AtomicSetPtr,(void **a, void *b))
+SDL2_PROTO(void*,AtomicGetPtr,(void **a))
+SDL2_PROTO(int,GetNumAudioDrivers,(void))
+SDL2_PROTO(const char*,GetAudioDriver,(int a))
+SDL2_PROTO(int,AudioInit,(const char *a))
+SDL2_PROTO(void,AudioQuit,(void))
+SDL2_PROTO(const char*,GetCurrentAudioDriver,(void))
+SDL2_PROTO(int,OpenAudio,(SDL_AudioSpec *a, SDL_AudioSpec *b))
+SDL2_PROTO(int,GetNumAudioDevices,(int a))
+SDL2_PROTO(const char*,SDL_GetAudioDeviceName,(int a, int b))
+SDL2_PROTO(SDL_AudioDeviceID,OpenAudioDevice,(const char *a, int b, const SDL_AudioSpec *c, SDL_AudioSpec *d, int e))
+SDL2_PROTO(SDL_AudioStatus,GetAudioStatus,(void))
+SDL2_PROTO(SDL_AudioStatus,GetAudioDeviceStatus,(SDL_AudioDeviceID a))
+SDL2_PROTO(void,PauseAudio,(int a))
+SDL2_PROTO(void,PauseAudioDevice,(SDL_AudioDeviceID a, int b))
+SDL2_PROTO(SDL_AudioSpec*,LoadWAV_RW,(SDL2_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e))
+SDL2_PROTO(void,FreeWAV,(Uint8 *a))
+SDL2_PROTO(int,BuildAudioCVT,(SDL_AudioCVT *a, SDL_AudioFormat b, Uint8 c, int d, SDL_AudioFormat e, Uint8 f, int g))
+SDL2_PROTO(int,ConvertAudio,(SDL_AudioCVT *a))
+SDL2_PROTO(void,MixAudio,(Uint8 *a, const Uint8 *b, Uint32 c, int d))
+SDL2_PROTO(void,MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e))
+SDL2_PROTO(void,LockAudio,(void))
+SDL2_PROTO(void,LockAudioDevice,(SDL_AudioDeviceID a))
+SDL2_PROTO(void,UnlockAudio,(void))
+SDL2_PROTO(void,UnlockAudioDevice,(SDL_AudioDeviceID a))
+SDL2_PROTO(void,CloseAudio,(void))
+SDL2_PROTO(void,CloseAudioDevice,(SDL_AudioDeviceID a))
+SDL2_PROTO(int,SetClipboardText,(const char *a))
+SDL2_PROTO(char*,GetClipboardText,(void))
+SDL2_PROTO(SDL_bool,HasClipboardText,(void))
+SDL2_PROTO(int,GetCPUCount,(void))
+SDL2_PROTO(int,GetCPUCacheLineSize,(void))
+SDL2_PROTO(SDL_bool,HasRDTSC,(void))
+SDL2_PROTO(SDL_bool,HasAltiVec,(void))
+SDL2_PROTO(SDL_bool,HasMMX,(void))
+SDL2_PROTO(SDL_bool,Has3DNow,(void))
+SDL2_PROTO(SDL_bool,HasSSE,(void))
+SDL2_PROTO(SDL_bool,HasSSE2,(void))
+SDL2_PROTO(SDL_bool,HasSSE3,(void))
+SDL2_PROTO(SDL_bool,HasSSE41,(void))
+SDL2_PROTO(SDL_bool,HasSSE42,(void))
+SDL2_PROTO(int,GetSystemRAM,(void))
+SDL2_PROTO(const char*,GetError,(void))
+SDL2_PROTO(void,ClearError,(void))
+SDL2_PROTO(int,Error,(SDL_errorcode a))
+SDL2_PROTO(void,PumpEvents,(void))
+SDL2_PROTO(int,PeepEvents,(SDL2_Event *a, int b, SDL_eventaction c, Uint32 d, Uint32 e))
+SDL2_PROTO(SDL_bool,HasEvent,(Uint32 a))
+SDL2_PROTO(SDL_bool,HasEvents,(Uint32 a, Uint32 b))
+SDL2_PROTO(void,FlushEvent,(Uint32 a))
+SDL2_PROTO(void,FlushEvents,(Uint32 a, Uint32 b))
+SDL2_PROTO(int,PollEvent,(SDL2_Event *a))
+SDL2_PROTO(int,WaitEvent,(SDL2_Event *a))
+SDL2_PROTO(int,WaitEventTimeout,(SDL2_Event *a, int b))
+SDL2_PROTO(int,PushEvent,(SDL2_Event *a))
+SDL2_PROTO(void,SetEventFilter,(SDL2_EventFilter a, void *b))
+SDL2_PROTO(SDL_bool,GetEventFilter,(SDL2_EventFilter *a, void **b))
+SDL2_PROTO(void,AddEventWatch,(SDL2_EventFilter a, void *b))
+SDL2_PROTO(void,DelEventWatch,(SDL2_EventFilter a, void *b))
+SDL2_PROTO(void,FilterEvents,(SDL2_EventFilter a, void *b))
+SDL2_PROTO(Uint8,EventState,(Uint32 a, int b))
+SDL2_PROTO(Uint32,RegisterEvents,(int a))
+SDL2_PROTO(char*,GetBasePath,(void))
+SDL2_PROTO(char*,GetPrefPath,(const char *a, const char *b))
+SDL2_PROTO(int,GameControllerAddMapping,(const char *a))
+SDL2_PROTO(char*,GameControllerMappingForGUID,(SDL_JoystickGUID a))
+SDL2_PROTO(char*,GameControllerMapping,(SDL_GameController *a))
+SDL2_PROTO(SDL_bool,IsGameController,(int a))
+SDL2_PROTO(const char*,GameControllerNameForIndex,(int a))
+SDL2_PROTO(SDL_GameController*,GameControllerOpen,(int a))
+SDL2_PROTO(const char*,GameControllerName,(SDL_GameController *a))
+SDL2_PROTO(SDL_bool,GameControllerGetAttached,(SDL_GameController *a))
+SDL2_PROTO(SDL_Joystick*,GameControllerGetJoystick,(SDL_GameController *a))
+SDL2_PROTO(int,GameControllerEventState,(int a))
+SDL2_PROTO(void,GameControllerUpdate,(void))
+SDL2_PROTO(SDL_GameControllerAxis,GameControllerGetAxisFromString,(const char *a))
+SDL2_PROTO(const char*,GameControllerGetStringForAxis,(SDL_GameControllerAxis a))
+SDL2_PROTO(SDL_GameControllerButtonBind,GameControllerGetBindForAxis,(SDL_GameController *a, SDL_GameControllerAxis b))
+SDL2_PROTO(Sint16,GameControllerGetAxis,(SDL_GameController *a, SDL_GameControllerAxis b))
+SDL2_PROTO(SDL_GameControllerButton,GameControllerGetButtonFromString,(const char *a))
+SDL2_PROTO(const char*,GameControllerGetStringForButton,(SDL_GameControllerButton a))
+SDL2_PROTO(SDL_GameControllerButtonBind,GameControllerGetBindForButton,(SDL_GameController *a, SDL_GameControllerButton b))
+SDL2_PROTO(Uint8,GameControllerGetButton,(SDL_GameController *a, SDL_GameControllerButton b))
+SDL2_PROTO(void,GameControllerClose,(SDL_GameController *a))
+SDL2_PROTO(int,RecordGesture,(SDL_TouchID a))
+SDL2_PROTO(int,SaveAllDollarTemplates,(SDL2_RWops *a))
+SDL2_PROTO(int,SaveDollarTemplate,(SDL2_GestureID a, SDL2_RWops *b))
+SDL2_PROTO(int,LoadDollarTemplates,(SDL_TouchID a, SDL2_RWops *b))
+SDL2_PROTO(int,NumHaptics,(void))
+SDL2_PROTO(const char*,HapticName,(int a))
+SDL2_PROTO(SDL_Haptic*,HapticOpen,(int a))
+SDL2_PROTO(int,HapticOpened,(int a))
+SDL2_PROTO(int,HapticIndex,(SDL_Haptic *a))
+SDL2_PROTO(int,MouseIsHaptic,(void))
+SDL2_PROTO(SDL_Haptic*,HapticOpenFromMouse,(void))
+SDL2_PROTO(int,JoystickIsHaptic,(SDL_Joystick *a))
+SDL2_PROTO(SDL_Haptic*,HapticOpenFromJoystick,(SDL_Joystick *a))
+SDL2_PROTO(void,HapticClose,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticNumEffects,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticNumEffectsPlaying,(SDL_Haptic *a))
+SDL2_PROTO(unsigned int,HapticQuery,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticNumAxes,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticEffectSupported,(SDL_Haptic *a, SDL_HapticEffect *b))
+SDL2_PROTO(int,HapticNewEffect,(SDL_Haptic *a, SDL_HapticEffect *b))
+SDL2_PROTO(int,HapticUpdateEffect,(SDL_Haptic *a, int b, SDL_HapticEffect *c))
+SDL2_PROTO(int,HapticRunEffect,(SDL_Haptic *a, int b, Uint32 c))
+SDL2_PROTO(int,HapticStopEffect,(SDL_Haptic *a, int b))
+SDL2_PROTO(void,HapticDestroyEffect,(SDL_Haptic *a, int b))
+SDL2_PROTO(int,HapticGetEffectStatus,(SDL_Haptic *a, int b))
+SDL2_PROTO(int,HapticSetGain,(SDL_Haptic *a, int b))
+SDL2_PROTO(int,HapticSetAutocenter,(SDL_Haptic *a, int b))
+SDL2_PROTO(int,HapticPause,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticUnpause,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticStopAll,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticRumbleSupported,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticRumbleInit,(SDL_Haptic *a))
+SDL2_PROTO(int,HapticRumblePlay,(SDL_Haptic *a, float b, Uint32 c))
+SDL2_PROTO(int,HapticRumbleStop,(SDL_Haptic *a))
+SDL2_PROTO(SDL_bool,SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c))
+SDL2_PROTO(SDL_bool,SetHint,(const char *a, const char *b))
+SDL2_PROTO(const char*,GetHint,(const char *a))
+SDL2_PROTO(void,AddHintCallback,(const char *a, SDL_HintCallback b, void *c))
+SDL2_PROTO(void,DelHintCallback,(const char *a, SDL_HintCallback b, void *c))
+SDL2_PROTO(void,ClearHints,(void))
+SDL2_PROTO(int,NumJoysticks,(void))
+SDL2_PROTO(const char*,JoystickNameForIndex,(int a))
+SDL2_PROTO(SDL_Joystick*,JoystickOpen,(int a))
+SDL2_PROTO(const char*,JoystickName,(SDL_Joystick *a))
+SDL2_PROTO(SDL_JoystickGUID,JoystickGetDeviceGUID,(int a))
+SDL2_PROTO(SDL_JoystickGUID,JoystickGetGUID,(SDL_Joystick *a))
+SDL2_PROTO(void,JoystickGetGUIDString,(SDL_JoystickGUID a, char *b, int c))
+SDL2_PROTO(SDL_JoystickGUID,JoystickGetGUIDFromString,(const char *a))
+SDL2_PROTO(SDL_bool,JoystickGetAttached,(SDL_Joystick *a))
+SDL2_PROTO(SDL2_JoystickID,JoystickInstanceID,(SDL_Joystick *a))
+SDL2_PROTO(int,JoystickNumAxes,(SDL_Joystick *a))
+SDL2_PROTO(int,JoystickNumBalls,(SDL_Joystick *a))
+SDL2_PROTO(int,JoystickNumHats,(SDL_Joystick *a))
+SDL2_PROTO(int,JoystickNumButtons,(SDL_Joystick *a))
+SDL2_PROTO(void,JoystickUpdate,(void))
+SDL2_PROTO(int,JoystickEventState,(int a))
+SDL2_PROTO(Sint16,JoystickGetAxis,(SDL_Joystick *a, int b))
+SDL2_PROTO(Uint8,JoystickGetHat,(SDL_Joystick *a, int b))
+SDL2_PROTO(int,JoystickGetBall,(SDL_Joystick *a, int b, int *c, int *d))
+SDL2_PROTO(Uint8,JoystickGetButton,(SDL_Joystick *a, int b))
+SDL2_PROTO(void,JoystickClose,(SDL_Joystick *a))
+SDL2_PROTO(SDL_Window*,GetKeyboardFocus,(void))
+SDL2_PROTO(const Uint8*,GetKeyboardState,(int *a))
+SDL2_PROTO(SDL_Keymod,GetModState,(void))
+SDL2_PROTO(void,SetModState,(SDL_Keymod a))
+SDL2_PROTO(SDL_Keycode,GetKeyFromScancode,(SDL_Scancode a))
+SDL2_PROTO(SDL_Scancode,GetScancodeFromKey,(SDL_Keycode a))
+SDL2_PROTO(const char*,GetScancodeName,(SDL_Scancode a))
+SDL2_PROTO(SDL_Scancode,GetScancodeFromName,(const char *a))
+SDL2_PROTO(const char*,GetKeyName,(SDL_Keycode a))
+SDL2_PROTO(SDL_Keycode,GetKeyFromName,(const char *a))
+SDL2_PROTO(void,StartTextInput,(void))
+SDL2_PROTO(SDL_bool,IsTextInputActive,(void))
+SDL2_PROTO(void,StopTextInput,(void))
+SDL2_PROTO(void,SetTextInputRect,(const SDL_Rect *a))
+SDL2_PROTO(SDL_bool,HasScreenKeyboardSupport,(void))
+SDL2_PROTO(SDL_bool,IsScreenKeyboardShown,(SDL_Window *a))
+SDL2_PROTO(void*,LoadObject,(const char *a))
+SDL2_PROTO(void*,LoadFunction,(void *a, const char *b))
+SDL2_PROTO(void,UnloadObject,(void *a))
+SDL2_PROTO(void,LogSetAllPriority,(SDL_LogPriority a))
+SDL2_PROTO(void,LogSetPriority,(int a, SDL_LogPriority b))
+SDL2_PROTO(SDL_LogPriority,LogGetPriority,(int a))
+SDL2_PROTO(void,LogResetPriorities,(void))
+SDL2_PROTO(void,LogMessageV,(int a, SDL_LogPriority b, const char *c, va_list d))
+SDL2_PROTO(void,LogGetOutputFunction,(SDL_LogOutputFunction *a, void **b))
+SDL2_PROTO(void,LogSetOutputFunction,(SDL_LogOutputFunction a, void *b))
+SDL2_PROTO(void,SetMainReady,(void))
+SDL2_PROTO(int,ShowMessageBox,(const SDL_MessageBoxData *a, int *b))
+SDL2_PROTO(int,ShowSimpleMessageBox,(Uint32 a, const char *b, const char *c, SDL_Window *d))
+SDL2_PROTO(SDL_Window*,GetMouseFocus,(void))
+SDL2_PROTO(Uint32,GetMouseState,(int *a, int *b))
+SDL2_PROTO(Uint32,GetRelativeMouseState,(int *a, int *b))
+SDL2_PROTO(void,WarpMouseInWindow,(SDL_Window *a, int b, int c))
+SDL2_PROTO(int,SetRelativeMouseMode,(SDL_bool a))
+SDL2_PROTO(SDL_bool,GetRelativeMouseMode,(void))
+SDL2_PROTO(SDL_Cursor*,CreateCursor,(const Uint8 *a, const Uint8 *b, int c, int d, int e, int f))
+SDL2_PROTO(SDL_Cursor*,CreateColorCursor,(SDL_Surface *a, int b, int c))
+SDL2_PROTO(SDL_Cursor*,CreateSystemCursor,(SDL_SystemCursor a))
+SDL2_PROTO(void,SetCursor,(SDL_Cursor *a))
+SDL2_PROTO(SDL_Cursor*,GetCursor,(void))
+SDL2_PROTO(SDL_Cursor*,GetDefaultCursor,(void))
+SDL2_PROTO(void,FreeCursor,(SDL_Cursor *a))
+SDL2_PROTO(int,ShowCursor,(int a))
+SDL2_PROTO(SDL_mutex*,CreateMutex,(void))
+SDL2_PROTO(int,LockMutex,(SDL_mutex *a))
+SDL2_PROTO(int,TryLockMutex,(SDL_mutex *a))
+SDL2_PROTO(int,UnlockMutex,(SDL_mutex *a))
+SDL2_PROTO(void,DestroyMutex,(SDL_mutex *a))
+SDL2_PROTO(SDL_sem*,CreateSemaphore,(Uint32 a))
+SDL2_PROTO(void,DestroySemaphore,(SDL_sem *a))
+SDL2_PROTO(int,SemWait,(SDL_sem *a))
+SDL2_PROTO(int,SemTryWait,(SDL_sem *a))
+SDL2_PROTO(int,SemWaitTimeout,(SDL_sem *a, Uint32 b))
+SDL2_PROTO(int,SemPost,(SDL_sem *a))
+SDL2_PROTO(Uint32,SemValue,(SDL_sem *a))
+SDL2_PROTO(SDL_cond*,CreateCond,(void))
+SDL2_PROTO(void,DestroyCond,(SDL_cond *a))
+SDL2_PROTO(int,CondSignal,(SDL_cond *a))
+SDL2_PROTO(int,CondBroadcast,(SDL_cond *a))
+SDL2_PROTO(int,CondWait,(SDL_cond *a, SDL_mutex *b))
+SDL2_PROTO(int,CondWaitTimeout,(SDL_cond *a, SDL_mutex *b, Uint32 c))
+SDL2_PROTO(const char*,GetPixelFormatName,(Uint32 a))
+SDL2_PROTO(SDL_bool,PixelFormatEnumToMasks,(Uint32 a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f))
+SDL2_PROTO(Uint32,MasksToPixelFormatEnum,(int a, Uint32 b, Uint32 c, Uint32 d, Uint32 e))
+SDL2_PROTO(SDL_PixelFormat*,AllocFormat,(Uint32 a))
+SDL2_PROTO(void,FreeFormat,(SDL_PixelFormat *a))
+SDL2_PROTO(SDL_Palette*,AllocPalette,(int a))
+SDL2_PROTO(int,SetPixelFormatPalette,(SDL_PixelFormat *a, SDL_Palette *b))
+SDL2_PROTO(int,SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d))
+SDL2_PROTO(void,FreePalette,(SDL_Palette *a))
+SDL2_PROTO(Uint32,MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d))
+SDL2_PROTO(Uint32,MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e))
+SDL2_PROTO(void,GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e))
+SDL2_PROTO(void,GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f))
+SDL2_PROTO(void,CalculateGammaRamp,(float a, Uint16 *b))
+SDL2_PROTO(const char*,GetPlatform,(void))
+SDL2_PROTO(SDL_PowerState,GetPowerInfo,(int *a, int *b))
+SDL2_PROTO(SDL_bool,HasIntersection,(const SDL_Rect *a, const SDL_Rect *b))
+SDL2_PROTO(SDL_bool,IntersectRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c))
+SDL2_PROTO(void,UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c))
+SDL2_PROTO(SDL_bool,EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d))
+SDL2_PROTO(SDL_bool,IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e))
+SDL2_PROTO(int,GetNumRenderDrivers,(void))
+SDL2_PROTO(int,GetRenderDriverInfo,(int a, SDL_RendererInfo *b))
+SDL2_PROTO(int,CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e))
+SDL2_PROTO(SDL_Renderer*,CreateRenderer,(SDL_Window *a, int b, Uint32 c))
+SDL2_PROTO(SDL_Renderer*,CreateSoftwareRenderer,(SDL_Surface *a))
+SDL2_PROTO(SDL_Renderer*,GetRenderer,(SDL_Window *a))
+SDL2_PROTO(int,GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b))
+SDL2_PROTO(int,GetRendererOutputSize,(SDL_Renderer *a, int *b, int *c))
+SDL2_PROTO(SDL_Texture*,CreateTexture,(SDL_Renderer *a, Uint32 b, int c, int d, int e))
+SDL2_PROTO(SDL_Texture*,CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b))
+SDL2_PROTO(int,QueryTexture,(SDL_Texture *a, Uint32 *b, int *c, int *d, int *e))
+SDL2_PROTO(int,SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d))
+SDL2_PROTO(int,GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d))
+SDL2_PROTO(int,SetTextureAlphaMod,(SDL_Texture *a, Uint8 b))
+SDL2_PROTO(int,GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b))
+SDL2_PROTO(int,SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b))
+SDL2_PROTO(int,GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b))
+SDL2_PROTO(int,UpdateTexture,(SDL_Texture *a, const SDL_Rect *b, const void *c, int d))
+SDL2_PROTO(int,UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h))
+SDL2_PROTO(int,LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d))
+SDL2_PROTO(void,UnlockTexture,(SDL_Texture *a))
+SDL2_PROTO(SDL_bool,RenderTargetSupported,(SDL_Renderer *a))
+SDL2_PROTO(int,SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b))
+SDL2_PROTO(SDL_Texture*,GetRenderTarget,(SDL_Renderer *a))
+SDL2_PROTO(int,RenderSetLogicalSize,(SDL_Renderer *a, int b, int c))
+SDL2_PROTO(void,RenderGetLogicalSize,(SDL_Renderer *a, int *b, int *c))
+SDL2_PROTO(int,RenderSetViewport,(SDL_Renderer *a, const SDL_Rect *b))
+SDL2_PROTO(void,RenderGetViewport,(SDL_Renderer *a, SDL_Rect *b))
+SDL2_PROTO(int,RenderSetClipRect,(SDL_Renderer *a, const SDL_Rect *b))
+SDL2_PROTO(void,RenderGetClipRect,(SDL_Renderer *a, SDL_Rect *b))
+SDL2_PROTO(int,RenderSetScale,(SDL_Renderer *a, float b, float c))
+SDL2_PROTO(void,RenderGetScale,(SDL_Renderer *a, float *b, float *c))
+SDL2_PROTO(int,SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e))
+SDL2_PROTO(int,GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e))
+SDL2_PROTO(int,SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b))
+SDL2_PROTO(int,GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b))
+SDL2_PROTO(int,RenderClear,(SDL_Renderer *a))
+SDL2_PROTO(int,RenderDrawPoint,(SDL_Renderer *a, int b, int c))
+SDL2_PROTO(int,RenderDrawPoints,(SDL_Renderer *a, const SDL_Point *b, int c))
+SDL2_PROTO(int,RenderDrawLine,(SDL_Renderer *a, int b, int c, int d, int e))
+SDL2_PROTO(int,RenderDrawLines,(SDL_Renderer *a, const SDL_Point *b, int c))
+SDL2_PROTO(int,RenderDrawRect,(SDL_Renderer *a, const SDL_Rect *b))
+SDL2_PROTO(int,RenderDrawRects,(SDL_Renderer *a, const SDL_Rect *b, int c))
+SDL2_PROTO(int,RenderFillRect,(SDL_Renderer *a, const SDL_Rect *b))
+SDL2_PROTO(int,RenderFillRects,(SDL_Renderer *a, const SDL_Rect *b, int c))
+SDL2_PROTO(int,RenderCopy,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d))
+SDL2_PROTO(int,RenderCopyEx,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d, const double e, const SDL_Point *f, const SDL_RendererFlip g))
+SDL2_PROTO(int,RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b, Uint32 c, void *d, int e))
+SDL2_PROTO(void,RenderPresent,(SDL_Renderer *a))
+SDL2_PROTO(void,DestroyTexture,(SDL_Texture *a))
+SDL2_PROTO(void,DestroyRenderer,(SDL_Renderer *a))
+SDL2_PROTO(int,GL_BindTexture,(SDL_Texture *a, float *b, float *c))
+SDL2_PROTO(int,GL_UnbindTexture,(SDL_Texture *a))
+SDL2_PROTO(SDL2_RWops*,RWFromFile,(const char *a, const char *b))
+SDL2_PROTO(SDL2_RWops*,RWFromMem,(void *a, int b))
+SDL2_PROTO(SDL2_RWops*,RWFromConstMem,(const void *a, int b))
+SDL2_PROTO(SDL2_RWops*,AllocRW,(void))
+SDL2_PROTO(void,FreeRW,(SDL2_RWops *a))
+SDL2_PROTO(Uint8,ReadU8,(SDL2_RWops *a))
+SDL2_PROTO(Uint16,ReadLE16,(SDL2_RWops *a))
+SDL2_PROTO(Uint16,ReadBE16,(SDL2_RWops *a))
+SDL2_PROTO(Uint32,ReadLE32,(SDL2_RWops *a))
+SDL2_PROTO(Uint32,ReadBE32,(SDL2_RWops *a))
+SDL2_PROTO(Uint64,ReadLE64,(SDL2_RWops *a))
+SDL2_PROTO(Uint64,ReadBE64,(SDL2_RWops *a))
+SDL2_PROTO(size_t,WriteU8,(SDL2_RWops *a, Uint8 b))
+SDL2_PROTO(size_t,WriteLE16,(SDL2_RWops *a, Uint16 b))
+SDL2_PROTO(size_t,WriteBE16,(SDL2_RWops *a, Uint16 b))
+SDL2_PROTO(size_t,WriteLE32,(SDL2_RWops *a, Uint32 b))
+SDL2_PROTO(size_t,WriteBE32,(SDL2_RWops *a, Uint32 b))
+SDL2_PROTO(size_t,WriteLE64,(SDL2_RWops *a, Uint64 b))
+SDL2_PROTO(size_t,WriteBE64,(SDL2_RWops *a, Uint64 b))
+SDL2_PROTO(SDL_Window*,CreateShapedWindow,(const char *a, unsigned int b, unsigned int c, unsigned int d, unsigned int e, Uint32 f))
+SDL2_PROTO(SDL_bool,IsShapedWindow,(const SDL_Window *a))
+SDL2_PROTO(int,SetWindowShape,(SDL_Window *a, SDL_Surface *b, SDL_WindowShapeMode *c))
+SDL2_PROTO(int,GetShapedWindowMode,(SDL_Window *a, SDL_WindowShapeMode *b))
+SDL2_PROTO(void*,malloc,(size_t a))
+SDL2_PROTO(void*,calloc,(size_t a, size_t b))
+SDL2_PROTO(void*,realloc,(void *a, size_t b))
+SDL2_PROTO(void,free,(void *a))
+SDL2_PROTO(char*,getenv,(const char *a))
+SDL2_PROTO(int,setenv,(const char *a, const char *b, int c))
+SDL2_PROTO(void,qsort,(void *a, size_t b, size_t c, int (SDLCALL *d)(const void *, const void *)))
+SDL2_PROTO(int,abs,(int a))
+SDL2_PROTO(int,isdigit,(int a))
+SDL2_PROTO(int,isspace,(int a))
+SDL2_PROTO(int,toupper,(int a))
+SDL2_PROTO(int,tolower,(int a))
+SDL2_PROTO(void*,memset,(SDL_OUT_BYTECAP(c) void *a, int b, size_t c))
+SDL2_PROTO(void*,memcpy,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c))
+SDL2_PROTO(void*,memmove,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c))
+SDL2_PROTO(int,memcmp,(const void *a, const void *b, size_t c))
+SDL2_PROTO(size_t,wcslen,(const wchar_t *a))
+SDL2_PROTO(size_t,wcslcpy,(SDL_OUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c))
+SDL2_PROTO(size_t,wcslcat,(SDL_INOUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c))
+SDL2_PROTO(size_t,strlen,(const char *a))
+SDL2_PROTO(size_t,strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c))
+SDL2_PROTO(size_t,utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c))
+SDL2_PROTO(size_t,strlcat,(SDL_INOUT_Z_CAP(c) char *a, const char *b, size_t c))
+SDL2_PROTO(char*,strdup,(const char *a))
+SDL2_PROTO(char*,strrev,(char *a))
+SDL2_PROTO(char*,strupr,(char *a))
+SDL2_PROTO(char*,strlwr,(char *a))
+SDL2_PROTO(char*,strchr,(const char *a, int b))
+SDL2_PROTO(char*,strrchr,(const char *a, int b))
+SDL2_PROTO(char*,strstr,(const char *a, const char *b))
+SDL2_PROTO(char*,itoa,(int a, char *b, int c))
+SDL2_PROTO(char*,uitoa,(unsigned int a, char *b, int c))
+SDL2_PROTO(char*,ltoa,(long a, char *b, int c))
+SDL2_PROTO(char*,ultoa,(unsigned long a, char *b, int c))
+SDL2_PROTO(char*,lltoa,(Sint64 a, char *b, int c))
+SDL2_PROTO(char*,ulltoa,(Uint64 a, char *b, int c))
+SDL2_PROTO(int,atoi,(const char *a))
+SDL2_PROTO(double,atof,(const char *a))
+SDL2_PROTO(long,strtol,(const char *a, char **b, int c))
+SDL2_PROTO(unsigned long,strtoul,(const char *a, char **b, int c))
+SDL2_PROTO(Sint64,strtoll,(const char *a, char **b, int c))
+SDL2_PROTO(Uint64,strtoull,(const char *a, char **b, int c))
+SDL2_PROTO(double,strtod,(const char *a, char **b))
+SDL2_PROTO(int,strcmp,(const char *a, const char *b))
+SDL2_PROTO(int,strncmp,(const char *a, const char *b, size_t c))
+SDL2_PROTO(int,strcasecmp,(const char *a, const char *b))
+SDL2_PROTO(int,strncasecmp,(const char *a, const char *b, size_t c))
+SDL2_PROTO(int,vsnprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, const char *c, va_list d))
+SDL2_PROTO(double,acos,(double a))
+SDL2_PROTO(double,asin,(double a))
+SDL2_PROTO(double,atan,(double a))
+SDL2_PROTO(double,atan2,(double a, double b))
+SDL2_PROTO(double,ceil,(double a))
+SDL2_PROTO(double,copysign,(double a, double b))
+SDL2_PROTO(double,cos,(double a))
+SDL2_PROTO(float,cosf,(float a))
+SDL2_PROTO(double,fabs,(double a))
+SDL2_PROTO(double,floor,(double a))
+SDL2_PROTO(double,log,(double a))
+SDL2_PROTO(double,pow,(double a, double b))
+SDL2_PROTO(double,scalbn,(double a, int b))
+SDL2_PROTO(double,sin,(double a))
+SDL2_PROTO(float,sinf,(float a))
+SDL2_PROTO(double,sqrt,(double a))
+SDL2_PROTO(SDL_iconv_t,iconv_open,(const char *a, const char *b))
+SDL2_PROTO(int,iconv_close,(SDL_iconv_t a))
+SDL2_PROTO(size_t,iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e))
+SDL2_PROTO(char*,iconv_string,(const char *a, const char *b, const char *c, size_t d))
+SDL2_PROTO(SDL_Surface*,CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 e, Uint32 f, Uint32 g, Uint32 h))
+SDL2_PROTO(SDL_Surface*,CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i))
+SDL2_PROTO(void,FreeSurface,(SDL_Surface *a))
+SDL2_PROTO(int,SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b))
+SDL2_PROTO(int,LockSurface,(SDL_Surface *a))
+SDL2_PROTO(void,UnlockSurface,(SDL_Surface *a))
+SDL2_PROTO(SDL_Surface*,LoadBMP_RW,(SDL2_RWops *a, int b))
+SDL2_PROTO(int,SaveBMP_RW,(SDL_Surface *a, SDL2_RWops *b, int c))
+SDL2_PROTO(int,SetSurfaceRLE,(SDL_Surface *a, int b))
+SDL2_PROTO(int,SetColorKey,(SDL_Surface *a, int b, Uint32 c))
+SDL2_PROTO(int,GetColorKey,(SDL_Surface *a, Uint32 *b))
+SDL2_PROTO(int,SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d))
+SDL2_PROTO(int,GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d))
+SDL2_PROTO(int,SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b))
+SDL2_PROTO(int,GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b))
+SDL2_PROTO(int,SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b))
+SDL2_PROTO(int,GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b))
+SDL2_PROTO(SDL_bool,SetClipRect,(SDL_Surface *a, const SDL_Rect *b))
+SDL2_PROTO(void,GetClipRect,(SDL_Surface *a, SDL_Rect *b))
+SDL2_PROTO(SDL_Surface*,ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c))
+SDL2_PROTO(SDL_Surface*,ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b, Uint32 c))
+SDL2_PROTO(int,ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h))
+SDL2_PROTO(int,FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c))
+SDL2_PROTO(int,FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d))
+SDL2_PROTO(int,UpperBlit,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d))
+SDL2_PROTO(int,LowerBlit,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d))
+SDL2_PROTO(int,SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d))
+SDL2_PROTO(int,UpperBlitScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d))
+SDL2_PROTO(int,LowerBlitScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d))
+SDL2_PROTO(SDL_bool,GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b))
+SDL2_PROTO(const char*,GetThreadName,(SDL_Thread *a))
+SDL2_PROTO(SDL_threadID,ThreadID,(void))
+SDL2_PROTO(SDL_threadID,GetThreadID,(SDL_Thread *a))
+SDL2_PROTO(int,SetThreadPriority,(SDL_ThreadPriority a))
+SDL2_PROTO(void,WaitThread,(SDL_Thread *a, int *b))
+SDL2_PROTO(void,DetachThread,(SDL_Thread *a))
+SDL2_PROTO(SDL_TLSID,TLSCreate,(void))
+SDL2_PROTO(void*,TLSGet,(SDL_TLSID a))
+SDL2_PROTO(int,TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)))
+SDL2_PROTO(Uint32,GetTicks,(void))
+SDL2_PROTO(Uint64,GetPerformanceCounter,(void))
+SDL2_PROTO(Uint64,GetPerformanceFrequency,(void))
+SDL2_PROTO(void,Delay,(Uint32 a))
+SDL2_PROTO(SDL_TimerID,AddTimer,(Uint32 a, SDL_TimerCallback b, void *c))
+SDL2_PROTO(SDL_bool,RemoveTimer,(SDL_TimerID a))
+SDL2_PROTO(int,GetNumTouchDevices,(void))
+SDL2_PROTO(SDL_TouchID,GetTouchDevice,(int a))
+SDL2_PROTO(int,GetNumTouchFingers,(SDL_TouchID a))
+SDL2_PROTO(SDL_Finger*,GetTouchFinger,(SDL_TouchID a, int b))
+SDL2_PROTO(void,GetVersion,(SDL_version *a))
+SDL2_PROTO(const char*,GetRevision,(void))
+SDL2_PROTO(int,GetRevisionNumber,(void))
+SDL2_PROTO(int,GetNumVideoDrivers,(void))
+SDL2_PROTO(const char*,GetVideoDriver,(int a))
+SDL2_PROTO(int,VideoInit,(const char *a))
+SDL2_PROTO(void,VideoQuit,(void))
+SDL2_PROTO(const char*,GetCurrentVideoDriver,(void))
+SDL2_PROTO(int,GetNumVideoDisplays,(void))
+SDL2_PROTO(const char*,GetDisplayName,(int a))
+SDL2_PROTO(int,GetDisplayBounds,(int a, SDL_Rect *b))
+SDL2_PROTO(int,GetNumDisplayModes,(int a))
+SDL2_PROTO(int,GetDisplayMode,(int a, int b, SDL2_DisplayMode *c))
+SDL2_PROTO(int,GetDesktopDisplayMode,(int a, SDL2_DisplayMode *b))
+SDL2_PROTO(int,GetCurrentDisplayMode,(int a, SDL2_DisplayMode *b)

(Patch may be truncated, please check the link at the top of this post.)