sdl2-compat: Renamed DECLSPEC to SDL_DECLSPEC

From 086185cb7b69a37b3760e67c735fc400d920eaae Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 17 May 2024 17:53:25 -0700
Subject: [PATCH] Renamed DECLSPEC to SDL_DECLSPEC

---
 src/Makefile.w32        |   4 +-
 src/dynapi/SDL_dynapi.c |   6 +-
 src/sdl2_compat.c       | 718 ++++++++++++++++++++--------------------
 src/sdl2_protos.h       |   2 +-
 4 files changed, 365 insertions(+), 365 deletions(-)

diff --git a/src/Makefile.w32 b/src/Makefile.w32
index d440633..bc651e3 100644
--- a/src/Makefile.w32
+++ b/src/Makefile.w32
@@ -32,9 +32,9 @@ CFLAGS_DLL = $(CFLAGS)
 CFLAGS_DLL+= -bd
 # the include paths :
 CFLAGS_DLL+= -I"$(SDL2INC)"
-# we override the DECLSPEC define in begin_code.h, because we are using
+# we override the SDL_DECLSPEC define in begin_code.h, because we are using
 # an exports file to remove the _cdecl '_' prefix from the symbol names
-CFLAGS_DLL+= -DDECLSPEC=
+CFLAGS_DLL+= -DSDL_DECLSPEC=
 
 object_files= sdl2_compat.obj SDL_dynapi.obj
 resource_obj= version.res
diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c
index 50e4791..5d09623 100644
--- a/src/dynapi/SDL_dynapi.c
+++ b/src/dynapi/SDL_dynapi.c
@@ -205,7 +205,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
 /* Public API functions to jump into the jump table. */
 #if DISABLE_JUMP_MAGIC
 #define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
-    DECLSPEC rc SDLCALL fn params                  \
+    SDL_DECLSPEC rc SDLCALL fn params                  \
     {                                              \
         ret jump_table.fn args;                    \
     }
@@ -213,7 +213,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
 #include "SDL_dynapi_procs.h"
 #undef SDL_DYNAPI_PROC
 #undef SDL_DYNAPI_PROC_NO_VARARGS
-SDL_DYNAPI_VARARGS(DECLSPEC, , )
+SDL_DYNAPI_VARARGS(SDL_DECLSPEC, , )
 #else
 /* !!! FIXME: need the jump magic. */
 #error Write me.
@@ -345,7 +345,7 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
 /* Here's the exported entry point that fills in the jump table. */
 /*  Use specific types when an "int" might suffice to keep this sane. */
 typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
-extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
+extern SDL_DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
 
 Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
 {
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index ef473b4..e466eb8 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -37,12 +37,12 @@ This breaks the build when creating SDL_ ## DisableScreenSaver
 
 #if SDL_DYNAMIC_API
 #include "dynapi/SDL_dynapi_overrides.h"
-/* force DECLSPEC off...it's all internal symbols now.
+/* force SDL_DECLSPEC off...it's all internal symbols now.
    These will have actual #defines during SDL_dynapi.c only */
-#ifdef DECLSPEC
-#undef DECLSPEC
+#ifdef SDL_DECLSPEC
+#undef SDL_DECLSPEC
 #endif
-#define DECLSPEC
+#define SDL_DECLSPEC
 #endif
 
 #define STRINGIFY2(V) #V
@@ -139,12 +139,12 @@ extern "C" {
 
 /* Things that _should_ be binary compatible pass right through... */
 #define SDL3_SYM_PASSTHROUGH(rc,fn,params,args,ret) \
-    DECLSPEC rc SDLCALL SDL_##fn params { ret SDL3_##fn args; }
+    SDL_DECLSPEC rc SDLCALL SDL_##fn params { ret SDL3_##fn args; }
 #include "sdl3_syms.h"
 
 /* Things that were renamed and _should_ be binary compatible pass right through with the correct names... */
 #define SDL3_SYM_RENAMED(rc,oldfn,newfn,params,args,ret) \
-    DECLSPEC rc SDLCALL SDL_##oldfn params { ret SDL3_##newfn args; }
+    SDL_DECLSPEC rc SDLCALL SDL_##oldfn params { ret SDL3_##newfn args; }
 #include "sdl3_syms.h"
 
 
@@ -462,51 +462,51 @@ SDL2_to_SDL3_hint(const char *name)
     return name;
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
 {
     return SDL3_SetHintWithPriority(SDL2_to_SDL3_hint(name), value, priority);
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_SetHint(const char *name, const char *value)
 {
     return SDL3_SetHint(SDL2_to_SDL3_hint(name), value);
 }
 
-DECLSPEC const char * SDLCALL
+SDL_DECLSPEC const char * SDLCALL
 SDL_GetHint(const char *name)
 {
     return SDL3_GetHint(SDL2_to_SDL3_hint(name));
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_ResetHint(const char *name)
 {
     return SDL3_ResetHint(SDL2_to_SDL3_hint(name));
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_GetHintBoolean(const char *name, SDL_bool default_value)
 {
     return SDL3_GetHintBoolean(SDL2_to_SDL3_hint(name), default_value);
 }
 
 /* FIXME: callbacks may need tweaking ... */
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
 {
     /* this returns an int of 0 or -1 in SDL3, but SDL2 it was void (even if it failed). */
     (void) SDL3_AddHintCallback(SDL2_to_SDL3_hint(name), callback, userdata);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
 {
     SDL3_DelHintCallback(SDL2_to_SDL3_hint(name), callback, userdata);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_ClearHints(void)
 {
     SDL3_ResetHints();
@@ -1310,7 +1310,7 @@ SDL2Compat_InitOnStartup(void)
 
 
 /* obviously we have to override this so we don't report ourselves as SDL3. */
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_GetVersion(SDL2_version *ver)
 {
     if (ver) {
@@ -1325,7 +1325,7 @@ SDL_GetVersion(SDL2_version *ver)
     }
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetRevisionNumber(void)
 {
     /* After the move to GitHub, this always returned zero, since this was a
@@ -1333,20 +1333,20 @@ SDL_GetRevisionNumber(void)
     return 0;
 }
 
-DECLSPEC const char * SDLCALL
+SDL_DECLSPEC const char * SDLCALL
 SDL_GetRevision(void)
 {
     return SDL2COMPAT_REVISION;
 }
 
-DECLSPEC char * SDLCALL
+SDL_DECLSPEC char * SDLCALL
 SDL_GetErrorMsg(char *errstr, int maxlen)
 {
     SDL3_strlcpy(errstr, SDL3_GetError(), maxlen);
     return errstr;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SetError(const char *fmt, ...)
 {
     char ch;
@@ -1369,13 +1369,13 @@ SDL_SetError(const char *fmt, ...)
     return -1;
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_ClearError(void)
 {
     SDL3_ClearError();
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_Error(SDL_errorcode code)
 {
     switch (code) {
@@ -1394,7 +1394,7 @@ SDL_Error(SDL_errorcode code)
     }
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_sscanf(const char *text, const char *fmt, ...)
 {
     int retval;
@@ -1405,7 +1405,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...)
 {
     int retval;
@@ -1416,7 +1416,7 @@ SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...)
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_asprintf(char **str, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 {
     int retval;
@@ -1427,7 +1427,7 @@ SDL_asprintf(char **str, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     return retval;
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 {
     va_list ap;
@@ -1436,7 +1436,7 @@ SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     va_end(ap);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 {
     va_list ap;
@@ -1446,7 +1446,7 @@ SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING
 }
 
 #define SDL_LOG_IMPL(name, prio)                                             \
-DECLSPEC void SDLCALL                                                        \
+SDL_DECLSPEC void SDLCALL                                                        \
 SDL_Log##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
     va_list ap; va_start(ap, fmt);                                           \
     SDL3_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap);            \
@@ -1772,7 +1772,7 @@ Event2to3(const SDL2_Event *event2, SDL_Event *event3)
 
 static void GestureProcessEvent(const SDL_Event *event3);
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_PushEvent(SDL2_Event *event2)
 {
     SDL_Event event3;
@@ -1881,7 +1881,7 @@ static void CheckEventFilter(void)
     }
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_SetEventFilter(SDL2_EventFilter filter2, void *userdata)
 {
     CheckEventFilter();
@@ -1890,7 +1890,7 @@ SDL_SetEventFilter(SDL2_EventFilter filter2, void *userdata)
     EventFilterUserData2 = userdata;
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_GetEventFilter(SDL2_EventFilter *filter2, void **userdata)
 {
     if (!EventFilter2) {
@@ -1907,7 +1907,7 @@ SDL_GetEventFilter(SDL2_EventFilter *filter2, void **userdata)
     return SDL_TRUE;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_PeepEvents(SDL2_Event *events2, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)
 {
     SDL_Event *events3 = (SDL_Event *) SDL3_malloc(numevents * sizeof (SDL_Event));
@@ -1933,7 +1933,7 @@ SDL_PeepEvents(SDL2_Event *events2, int numevents, SDL_eventaction action, Uint3
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_WaitEventTimeout(SDL2_Event *event2, int timeout)
 {
     SDL_Event event3;
@@ -1944,19 +1944,19 @@ SDL_WaitEventTimeout(SDL2_Event *event2, int timeout)
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_PollEvent(SDL2_Event *event2)
 {
     return SDL_WaitEventTimeout(event2, 0);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_WaitEvent(SDL2_Event *event2)
 {
     return SDL_WaitEventTimeout(event2, -1);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_AddEventWatch(SDL2_EventFilter filter2, void *userdata)
 {
     EventFilterWrapperData *wrapperdata;
@@ -1976,7 +1976,7 @@ SDL_AddEventWatch(SDL2_EventFilter filter2, void *userdata)
     SDL3_UnlockMutex(EventWatchListMutex);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_DelEventWatch(SDL2_EventFilter filter2, void *userdata)
 {
     EventFilterWrapperData *i;
@@ -2006,7 +2006,7 @@ EventFilterWrapper3to2(void *userdata, SDL_Event *event)
     return wrapperdata->filter2(wrapperdata->userdata, Event3to2(event, &event2));
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_FilterEvents(SDL2_EventFilter filter2, void *userdata)
 {
     EventFilterWrapperData wrapperdata;
@@ -2016,20 +2016,20 @@ SDL_FilterEvents(SDL2_EventFilter filter2, void *userdata)
     SDL3_FilterEvents(EventFilterWrapper3to2, &wrapperdata);
 }
 
-DECLSPEC Uint32 SDLCALL
+SDL_DECLSPEC Uint32 SDLCALL
 SDL_RegisterEvents(int numevents)
 {
     Uint32 r = SDL3_RegisterEvents(numevents);
     return r > 0 ? r : (Uint32)(-1);
 }
 
-DECLSPEC SDL2_Keymod SDLCALL
+SDL_DECLSPEC SDL2_Keymod SDLCALL
 SDL_GetModState(void)
 {
     return SDL3_GetModState();
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_SetModState(SDL2_Keymod modstate)
 {
     SDL3_SetModState((SDL_Keymod)modstate);
@@ -2052,13 +2052,13 @@ static const char *ReplaceVideoBackendName(const char *name)
     return name;
 }
 
-DECLSPEC const char * SDLCALL
+SDL_DECLSPEC const char * SDLCALL
 SDL_GetVideoDriver(int idx)
 {
     return ReplaceVideoBackendName(SDL3_GetVideoDriver(idx));
 }
 
-DECLSPEC const char * SDLCALL
+SDL_DECLSPEC const char * SDLCALL
 SDL_GetCurrentVideoDriver(void)
 {
     return ReplaceVideoBackendName(SDL3_GetCurrentVideoDriver());
@@ -2067,7 +2067,7 @@ SDL_GetCurrentVideoDriver(void)
 
 /* mouse coords became floats in SDL3 */
 
-DECLSPEC Uint32 SDLCALL
+SDL_DECLSPEC Uint32 SDLCALL
 SDL_GetMouseState(int *x, int *y)
 {
     float fx, fy;
@@ -2077,7 +2077,7 @@ SDL_GetMouseState(int *x, int *y)
     return ret;
 }
 
-DECLSPEC Uint32 SDLCALL
+SDL_DECLSPEC Uint32 SDLCALL
 SDL_GetGlobalMouseState(int *x, int *y)
 {
     float fx, fy;
@@ -2087,7 +2087,7 @@ SDL_GetGlobalMouseState(int *x, int *y)
     return ret;
 }
 
-DECLSPEC Uint32 SDLCALL
+SDL_DECLSPEC Uint32 SDLCALL
 SDL_GetRelativeMouseState(int *x, int *y)
 {
     float fx, fy;
@@ -2097,13 +2097,13 @@ SDL_GetRelativeMouseState(int *x, int *y)
     return ret;
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_WarpMouseInWindow(SDL_Window *window, int x, int y)
 {
     SDL3_WarpMouseInWindow(window, (float)x, (float)y);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_WarpMouseGlobal(int x, int y)
 {
     return SDL3_WarpMouseGlobal((float)x, (float)y);
@@ -2170,7 +2170,7 @@ struct SDL2_RWops
     } hidden;
 };
 
-DECLSPEC SDL2_RWops *SDLCALL
+SDL_DECLSPEC SDL2_RWops *SDLCALL
 SDL_AllocRW(void)
 {
     SDL2_RWops *rwops2 = (SDL2_RWops *)SDL3_malloc(sizeof *rwops2);
@@ -2180,7 +2180,7 @@ SDL_AllocRW(void)
     return rwops2;
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_FreeRW(SDL2_RWops *rwops2)
 {
     SDL3_free(rwops2);
@@ -2249,7 +2249,7 @@ RWops3to2(SDL_IOStream *iostrm3, Uint32 type)
     return rwops2;
 }
 
-DECLSPEC SDL2_RWops *SDLCALL
+SDL_DECLSPEC SDL2_RWops *SDLCALL
 SDL_RWFromFile(const char *file, const char *mode)
 {
     SDL2_RWops *rwops2 = RWops3to2(SDL3_IOFromFile(file, mode), SDL_RWOPS_PLATFORM_FILE);
@@ -2285,7 +2285,7 @@ SDL_RWFromFile(const char *file, const char *mode)
     return rwops2;
 }
 
-DECLSPEC SDL2_RWops *SDLCALL
+SDL_DECLSPEC SDL2_RWops *SDLCALL
 SDL_RWFromMem(void *mem, int size)
 {
     if (size < 0) { /* SDL3 already checks size == 0 */
@@ -2295,7 +2295,7 @@ SDL_RWFromMem(void *mem, int size)
     return RWops3to2(SDL3_IOFromMem(mem, size), SDL_RWOPS_MEMORY);
 }
 
-DECLSPEC SDL2_RWops *SDLCALL
+SDL_DECLSPEC SDL2_RWops *SDLCALL
 SDL_RWFromConstMem(const void *mem, int size)
 {
     if (size < 0) { /* SDL3 already checks size == 0 */
@@ -2305,43 +2305,43 @@ SDL_RWFromConstMem(const void *mem, int size)
     return RWops3to2(SDL3_IOFromConstMem(mem, size), SDL_RWOPS_MEMORY_RO);
 }
 
-DECLSPEC Sint64 SDLCALL
+SDL_DECLSPEC Sint64 SDLCALL
 SDL_RWsize(SDL2_RWops *rwops2)
 {
     return rwops2->size(rwops2);
 }
 
-DECLSPEC Sint64 SDLCALL
+SDL_DECLSPEC Sint64 SDLCALL
 SDL_RWseek(SDL2_RWops *rwops2, Sint64 offset, int whence)
 {
     return rwops2->seek(rwops2, offset, whence);
 }
 
-DECLSPEC Sint64 SDLCALL
+SDL_DECLSPEC Sint64 SDLCALL
 SDL_RWtell(SDL2_RWops *rwops2)
 {
     return rwops2->seek(rwops2, 0, SDL_IO_SEEK_CUR);
 }
 
-DECLSPEC size_t SDLCALL
+SDL_DECLSPEC size_t SDLCALL
 SDL_RWread(SDL2_RWops *rwops2, void *ptr, size_t size, size_t maxnum)
 {
     return rwops2->read(rwops2, ptr, size, maxnum);
 }
 
-DECLSPEC size_t SDLCALL
+SDL_DECLSPEC size_t SDLCALL
 SDL_RWwrite(SDL2_RWops *rwops2, const void *ptr, size_t size, size_t num)
 {
     return rwops2->write(rwops2, ptr, size, num);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_RWclose(SDL2_RWops *rwops2)
 {
     return rwops2->close(rwops2);
 }
 
-DECLSPEC Uint8 SDLCALL
+SDL_DECLSPEC Uint8 SDLCALL
 SDL_ReadU8(SDL2_RWops *rwops2)
 {
     Uint8 x = 0;
@@ -2349,21 +2349,21 @@ SDL_ReadU8(SDL2_RWops *rwops2)
     return x;
 }
 
-DECLSPEC size_t SDLCALL
+SDL_DECLSPEC size_t SDLCALL
 SDL_WriteU8(SDL2_RWops *rwops2, Uint8 x)
 {
     return SDL_RWwrite(rwops2, &x, sizeof(x), 1);
 }
 
 #define DO_RWOPS_ENDIAN(order, bits)          \
-DECLSPEC Uint##bits SDLCALL                 \
+SDL_DECLSPEC Uint##bits SDLCALL                 \
 SDL_Read##order##bits(SDL2_RWops *rwops2) { \
     Uint##bits x = 0;                       \
     SDL_RWread(rwops2, &x, sizeof (x), 1);  \
     return SDL_Swap##order##bits(x);        \
 } \
                                                            \
-DECLSPEC size_t SDLCALL                                    \
+SDL_DECLSPEC size_t SDLCALL                                    \
 SDL_Write##order##bits(SDL2_RWops *rwops2, Uint##bits x) { \
     x = SDL_Swap##order##bits(x);                          \
     return SDL_RWwrite(rwops2, &x, sizeof(x), 1);          \
@@ -2378,7 +2378,7 @@ DO_RWOPS_ENDIAN(BE, 64)
 
 /* stdio SDL_RWops was removed from SDL3, to prevent incompatible C runtime issues */
 #ifndef HAVE_STDIO_H
-DECLSPEC SDL2_RWops * SDLCALL
+SDL_DECLSPEC SDL2_RWops * SDLCALL
 SDL_RWFromFP(void *fp, SDL_bool autoclose)
 {
     SDL3_SetError("SDL not compiled with stdio support");
@@ -2480,7 +2480,7 @@ stdio_close(SDL2_RWops *rwops2)
     return status;
 }
 
-DECLSPEC SDL2_RWops * SDLCALL
+SDL_DECLSPEC SDL2_RWops * SDLCALL
 SDL_RWFromFP(FILE *fp, SDL_bool autoclose)
 {
     SDL2_RWops *rwops = SDL_AllocRW();
@@ -2551,7 +2551,7 @@ RWops2to3(SDL2_RWops *rwops2)
     return iostrm3;
 }
 
-DECLSPEC void *SDLCALL
+SDL_DECLSPEC void *SDLCALL
 SDL_LoadFile_RW(SDL2_RWops *rwops2, size_t *datasize, int freesrc)
 {
     void *retval = NULL;
@@ -2568,7 +2568,7 @@ SDL_LoadFile_RW(SDL2_RWops *rwops2, size_t *datasize, int freesrc)
     return retval;
 }
 
-DECLSPEC SDL2_AudioSpec *SDLCALL
+SDL_DECLSPEC SDL2_AudioSpec *SDLCALL
 SDL_LoadWAV_RW(SDL2_RWops *rwops2, int freesrc, SDL2_AudioSpec *spec2, Uint8 **audio_buf, Uint32 *audio_len)
 {
     SDL2_AudioSpec *retval = NULL;
@@ -2599,7 +2599,7 @@ SDL_LoadWAV_RW(SDL2_RWops *rwops2, int freesrc, SDL2_AudioSpec *spec2, Uint8 **a
     return retval;
 }
 
-DECLSPEC SDL_Surface *SDLCALL
+SDL_DECLSPEC SDL_Surface *SDLCALL
 SDL_LoadBMP_RW(SDL2_RWops *rwops2, int freesrc)
 {
     SDL_Surface *retval = NULL;
@@ -2613,7 +2613,7 @@ SDL_LoadBMP_RW(SDL2_RWops *rwops2, int freesrc)
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SaveBMP_RW(SDL_Surface *surface, SDL2_RWops *rwops2, int freedst)
 {
     int retval = -1;
@@ -2627,7 +2627,7 @@ SDL_SaveBMP_RW(SDL_Surface *surface, SDL2_RWops *rwops2, int freedst)
     return retval;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GameControllerAddMappingsFromRW(SDL2_RWops *rwops2, int freerw)
 {
     int retval = -1;
@@ -2646,13 +2646,13 @@ SDL_GameControllerAddMappingsFromRW(SDL2_RWops *rwops2, int freerw)
    in intrusive ways, and often didn't work on various platforms. These all
    just return failure now. */
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SetWindowBrightness(SDL_Window *window, float brightness)
 {
     return SDL3_Unsupported();
 }
 
-DECLSPEC float SDLCALL
+SDL_DECLSPEC float SDLCALL
 SDL_GetWindowBrightness(SDL_Window *window)
 {
     if (!window) {
@@ -2661,13 +2661,13 @@ SDL_GetWindowBrightness(SDL_Window *window)
     return 1.0f;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *r, const Uint16 *g, const Uint16 *b)
 {
     return SDL3_Unsupported();
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_CalculateGammaRamp(float gamma, Uint16 *ramp)
 {
     int i;
@@ -2708,7 +2708,7 @@ SDL_CalculateGammaRamp(float gamma, Uint16 *ramp)
     }
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *blue, Uint16 *green)
 {
     Uint16 *buf;
@@ -2733,14 +2733,14 @@ SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *blue, Uint16 *gr
     return 0;
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_ConvertSurface(SDL_Surface *src, const SDL_PixelFormat *fmt, Uint32 flags)
 {
     (void) flags; /* SDL3 removed the (unused) `flags` argument */
     return SDL3_ConvertSurface(src, fmt);
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_ConvertSurfaceFormat(SDL_Surface * src, Uint32 pixel_format, Uint32 flags)
 {
     (void) flags; /* SDL3 removed the (unused) `flags` argument */
@@ -2751,19 +2751,19 @@ SDL_ConvertSurfaceFormat(SDL_Surface * src, Uint32 pixel_format, Uint32 flags)
 
 static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601;
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode)
 {
     SDL_YUV_ConversionMode = mode;
 }
 
-DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL
+SDL_DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL
 SDL_GetYUVConversionMode(void)
 {
     return SDL_YUV_ConversionMode;
 }
 
-DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL
+SDL_DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL
 SDL_GetYUVConversionModeForResolution(int width, int height)
 {
     SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionMode();
@@ -2794,7 +2794,7 @@ static SDL_Colorspace GetColorspaceForFormatAndSize(Uint32 format, int width, in
     return SDL_COLORSPACE_SRGB;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_ConvertPixels(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
 {
     SDL_Colorspace src_colorspace = GetColorspaceForFormatAndSize(src_format, width, height);
@@ -2802,81 +2802,81 @@ SDL_ConvertPixels(int width, int height, Uint32 src_format, const void *src, int
     return SDL3_ConvertPixelsAndColorspace(width, height, (SDL_PixelFormatEnum)src_format, src_colorspace, 0, src, src_pitch, (SDL_PixelFormatEnum)dst_format, dst_colorspace, 0, dst, dst_pitch);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_PremultiplyAlpha(int width, int height, Uint32 src_format, const void * src, int src_pitch, Uint32 dst_format, void * dst, int dst_pitch)
 {
     return SDL3_PremultiplyAlpha(width, height, (SDL_PixelFormatEnum)src_format, src, src_pitch, (SDL_PixelFormatEnum)dst_format, dst, dst_pitch);
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 {
     return SDL3_CreateSurface(width, height, SDL3_GetPixelFormatEnumForMasks(depth, Rmask, Gmask, Bmask, Amask));
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
 {
     return SDL3_CreateSurface(width, height, (SDL_PixelFormatEnum)format);
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 {
     return SDL3_CreateSurfaceFrom(pixels, width, height, pitch, SDL3_GetPixelFormatEnumForMasks(depth, Rmask, Gmask, Bmask, Amask));
 }
 
-DECLSPEC SDL_Surface * SDLCALL
+SDL_DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
 {
     return SDL3_CreateSurfaceFrom(pixels, width, height, pitch, (SDL_PixelFormatEnum)format);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_LowerBlit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 {
     return SDL3_BlitSurfaceUnchecked(src, srcrect, dst, dstrect);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_LowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 {
     return SDL3_BlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_UpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 {
     return SDL3_BlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
 {
     return SDL3_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
 {
     return SDL3_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
 }
 
 /* SDL_GetTicks is 64-bit in SDL3. Clamp it for SDL2. */
-DECLSPEC Uint32 SDLCALL
+SDL_DECLSPEC Uint32 SDLCALL
 SDL_GetTicks(void)
 {
     return (Uint32)SDL3_GetTicks();
 }
 
 /* SDL_GetTicks64 is gone in SDL3 because SDL_GetTicks is 64-bit. */
-DECLSPEC Uint64 SDLCALL
+SDL_DECLSPEC Uint64 SDLCALL
 SDL_GetTicks64(void)
 {
     return SDL3_GetTicks();
 }
 
-DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info)
+SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info)
 {
     const char *driver = SDL3_GetCurrentVideoDriver();
     SDL_PropertiesID props;
@@ -2978,20 +2978,20 @@ DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo
 
 
 /* this API was removed in SDL3; use sensor event timestamps instead! */
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values)
 {
     return SDL3_Unsupported();  /* !!! FIXME: maybe try to track this from SDL3 events if something needs this? I can't imagine this was widely used. */
 }
 
 /* this API was removed in SDL3; use sensor event timestamps instead! */
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values)
 {
     return SDL3_Unsupported();  /* !!! FIXME: maybe try to track this from SDL3 events if something needs this? I can't imagine this was widely used. */
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetNumTouchDevices(void)
 {
     SDL3_free(TouchDevices);
@@ -2999,7 +2999,7 @@ SDL_GetNumTouchDevices(void)
     return NumTouchDevices;
 }
 
-DECLSPEC SDL_TouchID SDLCALL
+SDL_DECLSPEC SDL_TouchID SDLCALL
 SDL_GetTouchDevice(int idx)
 {
     if ((idx < 0) || (idx >= NumTouchDevices)) {
@@ -3009,14 +3009,14 @@ SDL_GetTouchDevice(int idx)
     return TouchDevices[idx];
 }
 
-DECLSPEC const char* SDLCALL
+SDL_DECLSPEC const char* SDLCALL
 SDL_GetTouchName(int idx)
 {
     SDL_TouchID tid = SDL_GetTouchDevice(idx);
     return tid ? SDL3_GetTouchDeviceName(tid) : NULL;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetNumTouchFingers(SDL_TouchID touchID)
 {
     SDL3_free(TouchFingers);
@@ -3025,7 +3025,7 @@ SDL_GetNumTouchFingers(SDL_TouchID touchID)
     return NumTouchFingers;
 }
 
-DECLSPEC SDL_Finger * SDLCALL
+SDL_DECLSPEC SDL_Finger * SDLCALL
 SDL_GetTouchFinger(SDL_TouchID touchID, int idx)
 {
     if (touchID != TouchFingersDeviceID) {
@@ -3100,7 +3100,7 @@ GestureGetTouch(const SDL_TouchID touchId)
     return NULL;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_RecordGesture(SDL_TouchID touchId)
 {
     int numtouchdevs = 0;
@@ -3193,7 +3193,7 @@ GestureSaveTemplate(GestureDollarTemplate *templ, SDL2_RWops *dst)
     return 1;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SaveAllDollarTemplates(SDL2_RWops *dst)
 {
     int i, j, rtrn = 0;
@@ -3206,7 +3206,7 @@ SDL_SaveAllDollarTemplates(SDL2_RWops *dst)
     return rtrn;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SaveDollarTemplate(SDL2_GestureID gestureId, SDL2_RWops *dst)
 {
     int i, j;
@@ -3266,7 +3266,7 @@ GestureAddDollar(GestureTouch *inTouch, SDL_FPoint *path)
     return GestureAddDollar_one(inTouch, path);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL2_RWops *src)
 {
     int i, loaded = 0;
@@ -3752,7 +3752,7 @@ static void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode, SDL_Surface *shap
 }
 
 
-DECLSPEC SDL_Window * SDLCALL
+SDL_DECLSPEC SDL_Window * SDLCALL
 SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
 {
     flags |= (SDL_WINDOW_HIDDEN | SDL_WINDOW_TRANSPARENT);
@@ -3760,7 +3760,7 @@ SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsign
     return SDL_CreateWindow(title, (int)x, (int)y, (int)w, (int)h, flags);
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_IsShapedWindow(const SDL_Window *window)
 {
     if (SDL3_GetWindowFlags((SDL_Window *)window) & SDL_WINDOW_TRANSPARENT) {
@@ -3776,7 +3776,7 @@ static void SDLCALL CleanupFreeableProperty(void *userdata, void *value)
     SDL3_free(value);
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
 {
     SDL_Surface *surface;
@@ -3821,7 +3821,7 @@ SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *
     return result;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode)
 {
     SDL_WindowShapeMode *property = (SDL_WindowShapeMode *)SDL3_GetProperty(SDL3_GetWindowProperties(window), PROP_WINDOW_SHAPE_MODE_POINTER, NULL);
@@ -3836,7 +3836,7 @@ SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode)
 }
 
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetRendererInfo(SDL_Renderer *renderer, SDL2_RendererInfo *info)
 {
     SDL_RendererInfo info3;
@@ -3874,7 +3874,7 @@ SDL_GetRendererInfo(SDL_Renderer *renderer, SDL2_RendererInfo *info)
     return 0;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_GetRenderDriverInfo(int idx, SDL2_RendererInfo *info)
 {
     const char *name = SDL3_GetRenderDriver(idx);
@@ -3952,7 +3952,7 @@ static int FlushRendererIfNotBatching(SDL_Renderer *renderer)
 }
 
 /* Second parameter changed from an index to a string in SDL3. */
-DECLSPEC SDL_Renderer *SDLCALL
+SDL_DECLSPEC SDL_Renderer *SDLCALL
 SDL_CreateRenderer(SDL_Window *window, int idx, Uint32 flags)
 {
     SDL_PropertiesID props;
@@ -3993,32 +3993,32 @@ SDL_CreateRenderer(SDL_Window *window, int idx, Uint32 flags)
     return renderer;
 }
 
-DECLSPEC SDL_bool SDLCALL
+SDL_DECLSPEC SDL_bool SDLCALL
 SDL_RenderTargetSupported(SDL_Renderer *renderer)
 {
     /* All SDL3 renderers support target textures */
     return SDL_TRUE;
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
 {
     SDL3_GetRenderViewport(renderer, rect);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
 {
     SDL3_GetRenderClipRect(renderer, rect);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_RenderGetScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
 {
     SDL3_GetRenderScale(renderer, scaleX, scaleY);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_RenderWindowToLogical(SDL_Renderer *renderer,
                           int windowX, int windowY,
                           float *logicalX, float *logicalY)
@@ -4026,7 +4026,7 @@ SDL_RenderWindowToLogical(SDL_Renderer *renderer,
     SDL3_RenderCoordinatesFromWindow(renderer, (float)windowX, (float)windowY, logicalX, logicalY);
 }
 
-DECLSPEC void SDLCALL
+SDL_DECLSPEC void SDLCALL
 SDL_RenderLogicalToWindow(SDL_Renderer *renderer,
                           float logicalX, float logicalY,
                           int *windowX, int *windowY)
@@ -4037,7 +4037,7 @@ SDL_RenderLogicalToWindow(SDL_Renderer *renderer,
     if (windowY) *windowY = (int)y;
 }
 
-DECLSPEC int SDLCALL
+SDL_DECLSPEC int SDLCALL
 SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
 {
     int retval;
@@ -4049,13 +4049,13 @@ SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
     return retval < 0 ? ret

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