Simple Directmedia Layer

loadso: library handles are now `SDL_SharedObject*` instead of `void*`.

Improved the SDL_loadso.h documentation a little, too.

Fixes #11009.

+102 -73
+2
docs/README-migration.md
··· 1104 1104 1105 1105 ## SDL_loadso.h 1106 1106 1107 + Shared object handles are now `SDL_SharedObject *`, an opaque type, instead of `void *`. This is just for type-safety and there is no functional difference. 1108 + 1107 1109 SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior. 1108 1110 1109 1111 ## SDL_log.h
+31 -3
include/SDL3/SDL_loadso.h
··· 26 26 * 27 27 * System-dependent library loading routines. 28 28 * 29 + * Shared objects are code that is programmatically loadable at runtime. 30 + * Windows calls these "DLLs", Linux calls them "shared libraries", etc. 31 + * 32 + * To use them, build such a library, then call SDL_LoadObject() on it. 33 + * Once loaded, you can use SDL_LoadFunction() on that object to find the 34 + * address of its exported symbols. When done with the object, call 35 + * SDL_UnloadObject() to dispose of it. 36 + * 29 37 * Some things to keep in mind: 30 38 * 31 39 * - These functions only work on C function names. Other languages may have ··· 53 61 #endif 54 62 55 63 /** 64 + * An opaque datatype that represents a loaded shared object. 65 + * 66 + * \since This datatype is available since SDL 3.0.0. 67 + * 68 + * \sa SDL_LoadObject 69 + * \sa SDL_LoadFunction 70 + * \sa SDL_UnloadObject 71 + */ 72 + typedef struct SDL_SharedObject SDL_SharedObject; 73 + 74 + /** 56 75 * Dynamically load a shared object. 57 76 * 58 77 * \param sofile a system-dependent name of the object file. 59 78 * \returns an opaque pointer to the object handle or NULL on failure; call 60 79 * SDL_GetError() for more information. 61 80 * 81 + * \threadsafety It is safe to call this function from any thread. 82 + * 62 83 * \since This function is available since SDL 3.0.0. 63 84 * 64 85 * \sa SDL_LoadFunction 65 86 * \sa SDL_UnloadObject 66 87 */ 67 - extern SDL_DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile); 88 + extern SDL_DECLSPEC SDL_SharedObject * SDLCALL SDL_LoadObject(const char *sofile); 68 89 69 90 /** 70 91 * Look up the address of the named function in a shared object. ··· 86 107 * \returns a pointer to the function or NULL on failure; call SDL_GetError() 87 108 * for more information. 88 109 * 110 + * \threadsafety It is safe to call this function from any thread. 111 + * 89 112 * \since This function is available since SDL 3.0.0. 90 113 * 91 114 * \sa SDL_LoadObject 92 115 */ 93 - extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(void *handle, const char *name); 116 + extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject *handle, const char *name); 94 117 95 118 /** 96 119 * Unload a shared object from memory. 120 + * 121 + * Note that any pointers from this object looked up through SDL_LoadFunction() 122 + * will no longer be valid. 97 123 * 98 124 * \param handle a valid shared object handle returned by SDL_LoadObject(). 99 125 * 126 + * \threadsafety It is safe to call this function from any thread. 127 + * 100 128 * \since This function is available since SDL 3.0.0. 101 129 * 102 130 * \sa SDL_LoadObject 103 131 */ 104 - extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 132 + extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(SDL_SharedObject *handle); 105 133 106 134 /* Ends C function definitions when using C++ */ 107 135 #ifdef __cplusplus
+1 -1
src/audio/aaudio/SDL_aaudio.c
··· 55 55 56 56 typedef struct AAUDIO_Data 57 57 { 58 - void *handle; 58 + SDL_SharedObject *handle; 59 59 #define SDL_PROC(ret, func, params) ret (*func) params; 60 60 #include "SDL_aaudiofuncs.h" 61 61 } AAUDIO_Data;
+1 -1
src/audio/alsa/SDL_alsa_audio.c
··· 91 91 #define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof 92 92 93 93 static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC; 94 - static void *alsa_handle = NULL; 94 + static SDL_SharedObject *alsa_handle = NULL; 95 95 96 96 static bool load_alsa_sym(const char *fn, void **addr) 97 97 {
+1 -1
src/audio/directsound/SDL_directsound.c
··· 39 39 #endif 40 40 41 41 // DirectX function pointers for audio 42 - static void *DSoundDLL = NULL; 42 + static SDL_SharedObject *DSoundDLL = NULL; 43 43 typedef HRESULT(WINAPI *fnDirectSoundCreate8)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); 44 44 typedef HRESULT(WINAPI *fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID); 45 45 typedef HRESULT(WINAPI *fnDirectSoundCaptureCreate8)(LPCGUID, LPDIRECTSOUNDCAPTURE8 *, LPUNKNOWN);
+1 -1
src/audio/jack/SDL_jackaudio.c
··· 51 51 #ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC 52 52 53 53 static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC; 54 - static void *jack_handle = NULL; 54 + static SDL_SharedObject *jack_handle = NULL; 55 55 56 56 // !!! FIXME: this is copy/pasted in several places now 57 57 static bool load_jack_sym(const char *fn, void **addr)
+1 -1
src/audio/pipewire/SDL_pipewire.c
··· 92 92 #ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC 93 93 94 94 static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC; 95 - static void *pipewire_handle = NULL; 95 + static SDL_SharedObject *pipewire_handle = NULL; 96 96 97 97 static bool pipewire_dlsym(const char *fn, void **addr) 98 98 {
+1 -1
src/audio/pulseaudio/SDL_pulseaudio.c
··· 134 134 #ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC 135 135 136 136 static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC; 137 - static void *pulseaudio_handle = NULL; 137 + static SDL_SharedObject *pulseaudio_handle = NULL; 138 138 139 139 static bool load_pulseaudio_sym(const char *fn, void **addr) 140 140 {
+1 -1
src/audio/sndio/SDL_sndioaudio.c
··· 66 66 67 67 #ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC 68 68 static const char *sndio_library = SDL_AUDIO_DRIVER_SNDIO_DYNAMIC; 69 - static void *sndio_handle = NULL; 69 + static SDL_SharedObject *sndio_handle = NULL; 70 70 71 71 static bool load_sndio_sym(const char *fn, void **addr) 72 72 {
+1 -1
src/camera/pipewire/SDL_camera_pipewire.c
··· 101 101 #ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC 102 102 103 103 static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC; 104 - static void *pipewire_handle = NULL; 104 + static SDL_SharedObject *pipewire_handle = NULL; 105 105 106 106 static bool pipewire_dlsym(const char *fn, void **addr) 107 107 {
+1 -1
src/core/linux/SDL_dbus.c
··· 26 26 #ifdef SDL_USE_LIBDBUS 27 27 // we never link directly to libdbus. 28 28 static const char *dbus_library = "libdbus-1.so.3"; 29 - static void *dbus_handle = NULL; 29 + static SDL_SharedObject *dbus_handle = NULL; 30 30 static char *inhibit_handle = NULL; 31 31 static unsigned int screensaver_cookie = 0; 32 32 static SDL_DBusContext dbus;
+1 -1
src/core/linux/SDL_udev.h
··· 86 86 typedef struct SDL_UDEV_PrivateData 87 87 { 88 88 const char *udev_library; 89 - void *udev_handle; 89 + SDL_SharedObject *udev_handle; 90 90 struct udev *udev; 91 91 struct udev_monitor *udev_mon; 92 92 int ref_count;
+3 -3
src/dynapi/SDL_dynapi_procs.h
··· 654 654 SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_IO,(SDL_IOStream *a, bool b),(a,b),return) 655 655 SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return) 656 656 SDL_DYNAPI_PROC(void*,SDL_LoadFile_IO,(SDL_IOStream *a, size_t *b, bool c),(a,b,c),return) 657 - SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return) 658 - SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) 657 + SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(SDL_SharedObject *a, const char *b),(a,b),return) 658 + SDL_DYNAPI_PROC(SDL_SharedObject*,SDL_LoadObject,(const char *a),(a),return) 659 659 SDL_DYNAPI_PROC(bool,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return) 660 660 SDL_DYNAPI_PROC(bool,SDL_LoadWAV_IO,(SDL_IOStream *a, bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) 661 661 SDL_DYNAPI_PROC(bool,SDL_LockAudioStream,(SDL_AudioStream *a),(a),return) ··· 973 973 SDL_DYNAPI_PROC(char*,SDL_UCS4ToUTF8,(Uint32 a, char *b),(a,b),return) 974 974 SDL_DYNAPI_PROC(void,SDL_UnbindAudioStream,(SDL_AudioStream *a),(a),) 975 975 SDL_DYNAPI_PROC(void,SDL_UnbindAudioStreams,(SDL_AudioStream **a, int b),(a,b),) 976 - SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),) 976 + SDL_DYNAPI_PROC(void,SDL_UnloadObject,(SDL_SharedObject *a),(a),) 977 977 SDL_DYNAPI_PROC(bool,SDL_UnlockAudioStream,(SDL_AudioStream *a),(a),return) 978 978 SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) 979 979 SDL_DYNAPI_PROC(void,SDL_UnlockMutex,(SDL_Mutex *a),(a),)
+5 -4
src/gpu/d3d11/SDL_gpu_d3d11.c
··· 737 737 IDXGIInfoQueue *dxgiInfoQueue; 738 738 #endif 739 739 740 - void *d3d11_dll; 741 - void *dxgi_dll; 742 - void *dxgidebug_dll; 740 + SDL_SharedObject *d3d11_dll; 741 + SDL_SharedObject *dxgi_dll; 742 + SDL_SharedObject *dxgidebug_dll; 743 743 744 744 Uint8 debugMode; 745 745 BOOL supportsTearing; ··· 5886 5886 5887 5887 static bool D3D11_PrepareDriver(SDL_VideoDevice *this) 5888 5888 { 5889 - void *d3d11_dll, *dxgi_dll; 5889 + SDL_SharedObject *d3d11_dll; 5890 + SDL_SharedObject *dxgi_dll; 5890 5891 PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc; 5891 5892 D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 }; 5892 5893 PFN_CREATE_DXGI_FACTORY1 CreateDxgiFactoryFunc;
+4 -4
src/gpu/d3d12/SDL_gpu_d3d12.c
··· 576 576 IDXGIInfoQueue *dxgiInfoQueue; 577 577 #endif 578 578 IDXGIAdapter1 *adapter; 579 - void *dxgi_dll; 580 - void *dxgidebug_dll; 579 + SDL_SharedObject *dxgi_dll; 580 + SDL_SharedObject *dxgidebug_dll; 581 581 #endif 582 582 ID3D12Debug *d3d12Debug; 583 583 bool supportsTearing; ··· 7762 7762 #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 7763 7763 return true; 7764 7764 #else 7765 - void *d3d12Dll; 7766 - void *dxgiDll; 7765 + SDL_SharedObject *d3d12Dll; 7766 + SDL_SharedObject *dxgiDll; 7767 7767 PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc; 7768 7768 PFN_CREATE_DXGI_FACTORY1 CreateDXGIFactoryFunc; 7769 7769 HRESULT res;
+1 -1
src/hidapi/SDL_hidapi.c
··· 695 695 696 696 static struct 697 697 { 698 - void *libhandle; 698 + SDL_SharedObject *libhandle; 699 699 700 700 /* *INDENT-OFF* */ // clang-format off 701 701 int (LIBUSB_CALL *init)(libusb_context **ctx);
+1 -1
src/joystick/gdk/SDL_gameinputjoystick.c
··· 60 60 } GAMEINPUT_InternalJoystickHwdata; 61 61 62 62 static GAMEINPUT_InternalList g_GameInputList = { NULL }; 63 - static void *g_hGameInputDLL = NULL; 63 + static SDL_SharedObject *g_hGameInputDLL = NULL; 64 64 static IGameInput *g_pGameInput = NULL; 65 65 static GameInputCallbackToken g_GameInputCallbackToken = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; 66 66 static Uint64 g_GameInputTimestampOffset;
+4 -4
src/loadso/dlopen/SDL_sysloadso.c
··· 32 32 #include "../../video/uikit/SDL_uikitvideo.h" 33 33 #endif 34 34 35 - void *SDL_LoadObject(const char *sofile) 35 + SDL_SharedObject *SDL_LoadObject(const char *sofile) 36 36 { 37 37 void *handle; 38 38 const char *loaderror; ··· 49 49 if (!handle) { 50 50 SDL_SetError("Failed loading %s: %s", sofile, loaderror); 51 51 } 52 - return handle; 52 + return (SDL_SharedObject *) handle; 53 53 } 54 54 55 - SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name) 55 + SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name) 56 56 { 57 57 void *symbol = dlsym(handle, name); 58 58 if (!symbol) { ··· 72 72 return symbol; 73 73 } 74 74 75 - void SDL_UnloadObject(void *handle) 75 + void SDL_UnloadObject(SDL_SharedObject *handle) 76 76 { 77 77 if (handle) { 78 78 dlclose(handle);
+5 -7
src/loadso/dummy/SDL_sysloadso.c
··· 25 25 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 26 26 // System dependent library loading routines 27 27 28 - void *SDL_LoadObject(const char *sofile) 28 + SDL_SharedObject *SDL_LoadObject(const char *sofile) 29 29 { 30 - const char *loaderror = "SDL_LoadObject() not implemented"; 31 - SDL_SetError("Failed loading %s: %s", sofile, loaderror); 30 + SDL_Unsupported(); 32 31 return NULL; 33 32 } 34 33 35 - SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name) 34 + SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name) 36 35 { 37 - const char *loaderror = "SDL_LoadFunction() not implemented"; 38 - SDL_SetError("Failed loading %s: %s", name, loaderror); 36 + SDL_Unsupported(); 39 37 return NULL; 40 38 } 41 39 42 - void SDL_UnloadObject(void *handle) 40 + void SDL_UnloadObject(SDL_SharedObject *handle) 43 41 { 44 42 // no-op. 45 43 }
+7 -9
src/loadso/windows/SDL_sysloadso.c
··· 27 27 28 28 #include "../../core/windows/SDL_windows.h" 29 29 30 - void *SDL_LoadObject(const char *sofile) 30 + SDL_SharedObject *SDL_LoadObject(const char *sofile) 31 31 { 32 32 if (!sofile) { 33 33 SDL_InvalidParamError("sofile"); ··· 35 35 } 36 36 37 37 LPWSTR wstr = WIN_UTF8ToStringW(sofile); 38 - void *handle = (void *)LoadLibrary(wstr); 38 + HMODULE handle = LoadLibraryW(wstr); 39 39 SDL_free(wstr); 40 40 41 41 // Generate an error message if all loads failed 42 42 if (!handle) { 43 43 char errbuf[512]; 44 - SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf)); 45 - SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf)); 44 + SDL_snprintf(errbuf, sizeof (errbuf), "Failed loading %s", sofile); 46 45 WIN_SetError(errbuf); 47 46 } 48 - return handle; 47 + return (SDL_SharedObject *) handle; 49 48 } 50 49 51 - SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name) 50 + SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name) 52 51 { 53 52 SDL_FunctionPointer symbol = (SDL_FunctionPointer)GetProcAddress((HMODULE)handle, name); 54 53 if (!symbol) { 55 54 char errbuf[512]; 56 - SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf)); 57 - SDL_strlcat(errbuf, name, SDL_arraysize(errbuf)); 55 + SDL_snprintf(errbuf, sizeof (errbuf), "Failed loading %s", name); 58 56 WIN_SetError(errbuf); 59 57 } 60 58 return symbol; 61 59 } 62 60 63 - void SDL_UnloadObject(void *handle) 61 + void SDL_UnloadObject(SDL_SharedObject *handle) 64 62 { 65 63 if (handle) { 66 64 FreeLibrary((HMODULE)handle);
+2 -2
src/render/direct3d11/SDL_render_d3d11.c
··· 153 153 // Private renderer data 154 154 typedef struct 155 155 { 156 - void *hDXGIMod; 157 - void *hD3D11Mod; 156 + SDL_SharedObject *hDXGIMod; 157 + SDL_SharedObject *hD3D11Mod; 158 158 IDXGIFactory2 *dxgiFactory; 159 159 IDXGIAdapter *dxgiAdapter; 160 160 IDXGIDebug *dxgiDebug;
+2 -2
src/render/direct3d12/SDL_render_d3d12.c
··· 179 179 // Private renderer data 180 180 typedef struct 181 181 { 182 - void *hDXGIMod; 183 - void *hD3D12Mod; 182 + SDL_SharedObject *hDXGIMod; 183 + SDL_SharedObject *hD3D12Mod; 184 184 #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 185 185 UINT64 frameToken; 186 186 #else
+1 -1
src/storage/steam/SDL_steamstorage.c
··· 32 32 33 33 typedef struct STEAM_RemoteStorage 34 34 { 35 - void *libsteam_api; 35 + SDL_SharedObject *libsteam_api; 36 36 #define STEAM_PROC(ret, func, parms) \ 37 37 steamfntype_##func func; 38 38 #include "SDL_steamstorage_proc.h"
+1 -1
src/test/SDL_test_memory.c
··· 34 34 #include <dbghelp.h> 35 35 36 36 static struct { 37 - HMODULE module; 37 + SDL_SharedObject *module; 38 38 BOOL (WINAPI *pSymInitialize)(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess); 39 39 BOOL (WINAPI *pSymFromAddr)(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol); 40 40 BOOL (WINAPI *pSymGetLineFromAddr64)(HANDLE hProcess, DWORD64 qwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
+2 -1
src/video/SDL_egl.c
··· 299 299 300 300 static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_path) 301 301 { 302 - void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; 302 + SDL_SharedObject *egl_dll_handle = NULL; 303 + SDL_SharedObject *opengl_dll_handle = NULL; 303 304 const char *path = NULL; 304 305 #if defined(SDL_VIDEO_DRIVER_WINDOWS) 305 306 const char *d3dcompiler;
+2 -1
src/video/SDL_egl_c.h
··· 64 64 65 65 typedef struct SDL_EGL_VideoData 66 66 { 67 - void *opengl_dll_handle, *egl_dll_handle; 67 + SDL_SharedObject *opengl_dll_handle; 68 + SDL_SharedObject *egl_dll_handle; 68 69 EGLDisplay egl_display; 69 70 EGLConfig egl_config; 70 71 int egl_swapinterval;
+2 -2
src/video/SDL_sysvideo.h
··· 437 437 int egl_platform; 438 438 int driver_loaded; 439 439 char driver_path[256]; 440 - void *dll_handle; 440 + SDL_SharedObject *dll_handle; 441 441 } gl_config; 442 442 443 443 SDL_EGLAttribArrayCallback egl_platformattrib_callback; ··· 467 467 SDL_FunctionPointer vkEnumerateInstanceExtensionProperties; 468 468 int loader_loaded; 469 469 char loader_path[256]; 470 - void *loader_handle; 470 + SDL_SharedObject *loader_handle; 471 471 } vulkan_config; 472 472 473 473 /* * * */
+1 -1
src/video/haiku/SDL_bopengl.cc
··· 56 56 if ( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, 57 57 &location) == B_OK) { 58 58 59 - _this->gl_config.dll_handle = (void *) (addr_t) info.id; 59 + _this->gl_config.dll_handle = (SDL_SharedObject *) (addr_t) info.id; 60 60 _this->gl_config.driver_loaded = 1; 61 61 SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", 62 62 SDL_arraysize(_this->gl_config.driver_path));
+1 -1
src/video/vivante/SDL_vivantevideo.h
··· 39 39 #ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK 40 40 vdkPrivate vdk_private; 41 41 #else 42 - void *egl_handle; // EGL shared library handle 42 + SDL_SharedObject *egl_handle; // EGL shared library handle 43 43 EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay)(void *context); 44 44 EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex); 45 45 void(EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
+1 -1
src/video/wayland/SDL_waylanddyn.c
··· 30 30 31 31 typedef struct 32 32 { 33 - void *lib; 33 + SDL_SharedObject *lib; 34 34 const char *libname; 35 35 } waylanddynlib; 36 36
+1 -1
src/video/windows/SDL_windowskeyboard.c
··· 606 606 static void IME_SetupAPI(SDL_VideoData *videodata) 607 607 { 608 608 char ime_file[MAX_PATH + 1]; 609 - void *hime = 0; 609 + SDL_SharedObject *hime = 0; 610 610 HKL hkl = 0; 611 611 videodata->GetReadingString = NULL; 612 612 videodata->ShowReadingWindow = NULL;
+1 -1
src/video/windows/SDL_windowsmodes.c
··· 393 393 { 394 394 typedef HRESULT (WINAPI * PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); 395 395 PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL; 396 - void *hDXGIMod = NULL; 396 + SDL_SharedObject *hDXGIMod = NULL; 397 397 bool found = false; 398 398 399 399 hDXGIMod = SDL_LoadObject("dxgi.dll");
+4 -4
src/video/windows/SDL_windowsvideo.h
··· 389 389 390 390 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // Xbox doesn't support user32/shcore 391 391 // Touch input functions 392 - void *userDLL; 392 + SDL_SharedObject *userDLL; 393 393 /* *INDENT-OFF* */ // clang-format off 394 394 BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT ); 395 395 BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int ); ··· 410 410 LONG (WINAPI *DisplayConfigGetDeviceInfo)( DISPLAYCONFIG_DEVICE_INFO_HEADER*); 411 411 /* *INDENT-ON* */ // clang-format on 412 412 413 - void *shcoreDLL; 413 + SDL_SharedObject *shcoreDLL; 414 414 /* *INDENT-OFF* */ // clang-format off 415 415 HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor, 416 416 MONITOR_DPI_TYPE dpiType, ··· 421 421 #endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 422 422 423 423 #ifdef HAVE_DXGI_H 424 - void *dxgiDLL; 424 + SDL_SharedObject *dxgiDLL; 425 425 IDXGIFactory *pDXGIFactory; 426 426 #endif 427 427 ··· 475 475 476 476 #ifndef SDL_DISABLE_WINDOWS_IME 477 477 HKL ime_hkl; 478 - void *ime_himm32; 478 + SDL_SharedObject *ime_himm32; 479 479 /* *INDENT-OFF* */ // clang-format off 480 480 UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen); 481 481 BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
+4 -4
src/video/windows/SDL_windowswindow.c
··· 740 740 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 741 741 // FIXME: does not work on all hardware configurations with different renders (i.e. hybrid GPUs) 742 742 if (window->flags & SDL_WINDOW_TRANSPARENT) { 743 - void *handle = SDL_LoadObject("dwmapi.dll"); 743 + SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll"); 744 744 if (handle) { 745 745 DwmEnableBlurBehindWindow_t DwmEnableBlurBehindWindowFunc = (DwmEnableBlurBehindWindow_t)SDL_LoadFunction(handle, "DwmEnableBlurBehindWindow"); 746 746 if (DwmEnableBlurBehindWindowFunc) { ··· 1199 1199 { 1200 1200 DWM_WINDOW_CORNER_PREFERENCE oldPref = DWMWCP_DEFAULT; 1201 1201 1202 - void *handle = SDL_LoadObject("dwmapi.dll"); 1202 + SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll"); 1203 1203 if (handle) { 1204 1204 DwmGetWindowAttribute_t DwmGetWindowAttributeFunc = (DwmGetWindowAttribute_t)SDL_LoadFunction(handle, "DwmGetWindowAttribute"); 1205 1205 DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute"); ··· 1218 1218 { 1219 1219 COLORREF oldPref = DWMWA_COLOR_DEFAULT; 1220 1220 1221 - void *handle = SDL_LoadObject("dwmapi.dll"); 1221 + SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll"); 1222 1222 if (handle) { 1223 1223 DwmGetWindowAttribute_t DwmGetWindowAttributeFunc = (DwmGetWindowAttribute_t)SDL_LoadFunction(handle, "DwmGetWindowAttribute"); 1224 1224 DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute"); ··· 2223 2223 2224 2224 void WIN_UpdateDarkModeForHWND(HWND hwnd) 2225 2225 { 2226 - void *handle = SDL_LoadObject("dwmapi.dll"); 2226 + SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll"); 2227 2227 if (handle) { 2228 2228 DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute"); 2229 2229 if (DwmSetWindowAttributeFunc) {
+1 -1
src/video/x11/SDL_x11dyn.c
··· 34 34 35 35 typedef struct 36 36 { 37 - void *lib; 37 + SDL_SharedObject *lib; 38 38 const char *libname; 39 39 } x11dynlib; 40 40
+1 -1
src/video/x11/SDL_x11opengl.c
··· 164 164 bool X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path) 165 165 { 166 166 Display *display; 167 - void *handle; 167 + SDL_SharedObject *handle; 168 168 169 169 if (_this->gl_data) { 170 170 return SDL_SetError("OpenGL context already created");
+1 -1
src/video/x11/SDL_x11video.h
··· 145 145 146 146 #ifdef SDL_VIDEO_VULKAN 147 147 // Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL 148 - void *vulkan_xlib_xcb_library; 148 + SDL_SharedObject *vulkan_xlib_xcb_library; 149 149 PFN_XGetXCBConnection vulkan_XGetXCBConnection; 150 150 #endif 151 151
+1 -1
test/testloadso.c
··· 35 35 int hello = 0; 36 36 const char *libname = NULL; 37 37 const char *symname = NULL; 38 - void *lib = NULL; 38 + SDL_SharedObject *lib = NULL; 39 39 fntype fn = NULL; 40 40 SDLTest_CommonState *state; 41 41