From f13e14047a8086fe7dc33d64df6c203a775f899c Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 1 Oct 2024 12:16:27 -0400
Subject: [PATCH] loadso: Handle new SDL3 opaque type instead of `void *`.
---
src/sdl2_compat.c | 22 ++++++++++++++++++++++
src/sdl3_syms.h | 6 +++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 9eb9aa1..c507f6c 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -9436,6 +9436,28 @@ SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL2_bool active)
SDL3_hid_ble_scan(active);
}
+
+/* SDL_loadso Replaced void * with SDL_SharedObject * in SDL3. */
+
+SDL_DECLSPEC void * SDLCALL
+SDL_LoadObject(const char *soname)
+{
+ return (void *) SDL3_LoadObject(soname);
+}
+
+SDL_DECLSPEC void * SDLCALL
+SDL_LoadFunction(void *lib, const char *sym)
+{
+ return (void *) SDL3_LoadFunction((SDL_SharedObject *) lib, sym);
+}
+
+SDL_DECLSPEC void SDLCALL
+SDL_UnloadObject(void *lib)
+{
+ return SDL3_UnloadObject((SDL_SharedObject *) lib);
+}
+
+
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
static SDL2_WindowsMessageHook g_WindowsMessageHook = NULL;
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 87de593..580c73e 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -509,8 +509,8 @@ SDL3_SYM_RENAMED(void,JoystickUpdate,UpdateJoysticks,(void),(),)
SDL3_SYM(SDL_Surface*,LoadBMP_IO,(SDL_IOStream *a, bool b),(a,b),return)
SDL3_SYM_PASSTHROUGH(void*,LoadFile,(const char *a, size_t *b),(a,b),return)
SDL3_SYM(void*,LoadFile_IO,(SDL_IOStream *a, size_t *b, bool c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(void*,LoadFunction,(void *a, const char *b),(a,b),return)
-SDL3_SYM_PASSTHROUGH(void*,LoadObject,(const char *a),(a),return)
+SDL3_SYM(SDL_FunctionPointer,LoadFunction,(SDL_SharedObject *a, const char *b),(a,b),return)
+SDL3_SYM(SDL_SharedObject*,LoadObject,(const char *a),(a),return)
SDL3_SYM(bool,LoadWAV_IO,(SDL_IOStream *a, bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
SDL3_SYM(bool,LockAudioStream,(SDL_AudioStream *a),(a),return)
SDL3_SYM(void,LockMutex,(SDL_Mutex *a),(a),)
@@ -679,7 +679,7 @@ SDL3_SYM(Sint64,TellIO,(SDL_IOStream *a),(a),return)
SDL3_SYM(bool,TextInputActive,(SDL_Window *a),(a),return)
SDL3_SYM(bool,TryLockMutex,(SDL_Mutex *a),(a),return)
SDL3_SYM(bool,TryWaitSemaphore,(SDL_Semaphore *a),(a),return)
-SDL3_SYM_PASSTHROUGH(void,UnloadObject,(void *a),(a),)
+SDL3_SYM(void,UnloadObject,(SDL_SharedObject *a),(a),)
SDL3_SYM(bool,UnlockAudioStream,(SDL_AudioStream *a),(a),return)
SDL3_SYM(void,UnlockMutex,(SDL_Mutex *a),(a),)
SDL3_SYM(void,UnlockSurface,(SDL_Surface *a),(a),)