mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-23 02:43:30 +08:00
loadso: library handles are now SDL_SharedObject*
instead of void*
.
Improved the SDL_loadso.h documentation a little, too. Fixes #11009.
This commit is contained in:
parent
f351395c46
commit
0b5e01a305
@ -1104,6 +1104,8 @@ The following symbols have been renamed:
|
||||
|
||||
## SDL_loadso.h
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## SDL_log.h
|
||||
|
@ -26,6 +26,14 @@
|
||||
*
|
||||
* System-dependent library loading routines.
|
||||
*
|
||||
* Shared objects are code that is programmatically loadable at runtime.
|
||||
* Windows calls these "DLLs", Linux calls them "shared libraries", etc.
|
||||
*
|
||||
* To use them, build such a library, then call SDL_LoadObject() on it.
|
||||
* Once loaded, you can use SDL_LoadFunction() on that object to find the
|
||||
* address of its exported symbols. When done with the object, call
|
||||
* SDL_UnloadObject() to dispose of it.
|
||||
*
|
||||
* Some things to keep in mind:
|
||||
*
|
||||
* - These functions only work on C function names. Other languages may have
|
||||
@ -52,6 +60,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* An opaque datatype that represents a loaded shared object.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
typedef struct SDL_SharedObject SDL_SharedObject;
|
||||
|
||||
/**
|
||||
* Dynamically load a shared object.
|
||||
*
|
||||
@ -59,12 +78,14 @@ extern "C" {
|
||||
* \returns an opaque pointer to the object handle or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadFunction
|
||||
* \sa SDL_UnloadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
extern SDL_DECLSPEC SDL_SharedObject * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
|
||||
/**
|
||||
* Look up the address of the named function in a shared object.
|
||||
@ -86,22 +107,29 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
* \returns a pointer to the function or NULL on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
||||
extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject *handle, const char *name);
|
||||
|
||||
/**
|
||||
* Unload a shared object from memory.
|
||||
*
|
||||
* Note that any pointers from this object looked up through SDL_LoadFunction()
|
||||
* will no longer be valid.
|
||||
*
|
||||
* \param handle a valid shared object handle returned by SDL_LoadObject().
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_LoadObject
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(SDL_SharedObject *handle);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
@ -55,7 +55,7 @@ struct SDL_PrivateAudioData
|
||||
|
||||
typedef struct AAUDIO_Data
|
||||
{
|
||||
void *handle;
|
||||
SDL_SharedObject *handle;
|
||||
#define SDL_PROC(ret, func, params) ret (*func) params;
|
||||
#include "SDL_aaudiofuncs.h"
|
||||
} AAUDIO_Data;
|
||||
|
@ -91,7 +91,7 @@ static int (*ALSA_snd_pcm_chmap_print)(const snd_pcm_chmap_t *map, size_t maxlen
|
||||
#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
|
||||
|
||||
static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
|
||||
static void *alsa_handle = NULL;
|
||||
static SDL_SharedObject *alsa_handle = NULL;
|
||||
|
||||
static bool load_alsa_sym(const char *fn, void **addr)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ static bool SupportsIMMDevice = false;
|
||||
#endif
|
||||
|
||||
// DirectX function pointers for audio
|
||||
static void *DSoundDLL = NULL;
|
||||
static SDL_SharedObject *DSoundDLL = NULL;
|
||||
typedef HRESULT(WINAPI *fnDirectSoundCreate8)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
|
||||
typedef HRESULT(WINAPI *fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
|
||||
typedef HRESULT(WINAPI *fnDirectSoundCaptureCreate8)(LPCGUID, LPDIRECTSOUNDCAPTURE8 *, LPUNKNOWN);
|
||||
|
@ -51,7 +51,7 @@ static bool load_jack_syms(void);
|
||||
#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC
|
||||
|
||||
static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC;
|
||||
static void *jack_handle = NULL;
|
||||
static SDL_SharedObject *jack_handle = NULL;
|
||||
|
||||
// !!! FIXME: this is copy/pasted in several places now
|
||||
static bool load_jack_sym(const char *fn, void **addr)
|
||||
|
@ -92,7 +92,7 @@ static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *,
|
||||
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
||||
|
||||
static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC;
|
||||
static void *pipewire_handle = NULL;
|
||||
static SDL_SharedObject *pipewire_handle = NULL;
|
||||
|
||||
static bool pipewire_dlsym(const char *fn, void **addr)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ static bool load_pulseaudio_syms(void);
|
||||
#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
|
||||
|
||||
static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
|
||||
static void *pulseaudio_handle = NULL;
|
||||
static SDL_SharedObject *pulseaudio_handle = NULL;
|
||||
|
||||
static bool load_pulseaudio_sym(const char *fn, void **addr)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ static void (*SNDIO_sio_initpar)(struct sio_par *);
|
||||
|
||||
#ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
|
||||
static const char *sndio_library = SDL_AUDIO_DRIVER_SNDIO_DYNAMIC;
|
||||
static void *sndio_handle = NULL;
|
||||
static SDL_SharedObject *sndio_handle = NULL;
|
||||
|
||||
static bool load_sndio_sym(const char *fn, void **addr)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *,
|
||||
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
||||
|
||||
static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC;
|
||||
static void *pipewire_handle = NULL;
|
||||
static SDL_SharedObject *pipewire_handle = NULL;
|
||||
|
||||
static bool pipewire_dlsym(const char *fn, void **addr)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
// we never link directly to libdbus.
|
||||
static const char *dbus_library = "libdbus-1.so.3";
|
||||
static void *dbus_handle = NULL;
|
||||
static SDL_SharedObject *dbus_handle = NULL;
|
||||
static char *inhibit_handle = NULL;
|
||||
static unsigned int screensaver_cookie = 0;
|
||||
static SDL_DBusContext dbus;
|
||||
|
@ -86,7 +86,7 @@ typedef struct SDL_UDEV_Symbols
|
||||
typedef struct SDL_UDEV_PrivateData
|
||||
{
|
||||
const char *udev_library;
|
||||
void *udev_handle;
|
||||
SDL_SharedObject *udev_handle;
|
||||
struct udev *udev;
|
||||
struct udev_monitor *udev_mon;
|
||||
int ref_count;
|
||||
|
@ -654,8 +654,8 @@ SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_IO,(SDL_IOStream *a, bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadFile_IO,(SDL_IOStream *a, size_t *b, bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(SDL_SharedObject *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_SharedObject*,SDL_LoadObject,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(bool,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return)
|
||||
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)
|
||||
SDL_DYNAPI_PROC(bool,SDL_LockAudioStream,(SDL_AudioStream *a),(a),return)
|
||||
@ -973,7 +973,7 @@ SDL_DYNAPI_PROC(bool,SDL_TryWaitSemaphore,(SDL_Semaphore *a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_UCS4ToUTF8,(Uint32 a, char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnbindAudioStream,(SDL_AudioStream *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnbindAudioStreams,(SDL_AudioStream **a, int b),(a,b),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnloadObject,(SDL_SharedObject *a),(a),)
|
||||
SDL_DYNAPI_PROC(bool,SDL_UnlockAudioStream,(SDL_AudioStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UnlockMutex,(SDL_Mutex *a),(a),)
|
||||
|
@ -737,9 +737,9 @@ struct D3D11Renderer
|
||||
IDXGIInfoQueue *dxgiInfoQueue;
|
||||
#endif
|
||||
|
||||
void *d3d11_dll;
|
||||
void *dxgi_dll;
|
||||
void *dxgidebug_dll;
|
||||
SDL_SharedObject *d3d11_dll;
|
||||
SDL_SharedObject *dxgi_dll;
|
||||
SDL_SharedObject *dxgidebug_dll;
|
||||
|
||||
Uint8 debugMode;
|
||||
BOOL supportsTearing;
|
||||
@ -5886,7 +5886,8 @@ static bool D3D11_SupportsTextureFormat(
|
||||
|
||||
static bool D3D11_PrepareDriver(SDL_VideoDevice *this)
|
||||
{
|
||||
void *d3d11_dll, *dxgi_dll;
|
||||
SDL_SharedObject *d3d11_dll;
|
||||
SDL_SharedObject *dxgi_dll;
|
||||
PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
|
||||
D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 };
|
||||
PFN_CREATE_DXGI_FACTORY1 CreateDxgiFactoryFunc;
|
||||
|
@ -576,8 +576,8 @@ struct D3D12Renderer
|
||||
IDXGIInfoQueue *dxgiInfoQueue;
|
||||
#endif
|
||||
IDXGIAdapter1 *adapter;
|
||||
void *dxgi_dll;
|
||||
void *dxgidebug_dll;
|
||||
SDL_SharedObject *dxgi_dll;
|
||||
SDL_SharedObject *dxgidebug_dll;
|
||||
#endif
|
||||
ID3D12Debug *d3d12Debug;
|
||||
bool supportsTearing;
|
||||
@ -7762,8 +7762,8 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
|
||||
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
|
||||
return true;
|
||||
#else
|
||||
void *d3d12Dll;
|
||||
void *dxgiDll;
|
||||
SDL_SharedObject *d3d12Dll;
|
||||
SDL_SharedObject *dxgiDll;
|
||||
PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc;
|
||||
PFN_CREATE_DXGI_FACTORY1 CreateDXGIFactoryFunc;
|
||||
HRESULT res;
|
||||
|
@ -695,7 +695,7 @@ typedef struct DRIVER_hid_device_ DRIVER_hid_device;
|
||||
|
||||
static struct
|
||||
{
|
||||
void *libhandle;
|
||||
SDL_SharedObject *libhandle;
|
||||
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
int (LIBUSB_CALL *init)(libusb_context **ctx);
|
||||
|
@ -60,7 +60,7 @@ typedef struct joystick_hwdata
|
||||
} GAMEINPUT_InternalJoystickHwdata;
|
||||
|
||||
static GAMEINPUT_InternalList g_GameInputList = { NULL };
|
||||
static void *g_hGameInputDLL = NULL;
|
||||
static SDL_SharedObject *g_hGameInputDLL = NULL;
|
||||
static IGameInput *g_pGameInput = NULL;
|
||||
static GameInputCallbackToken g_GameInputCallbackToken = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE;
|
||||
static Uint64 g_GameInputTimestampOffset;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "../../video/uikit/SDL_uikitvideo.h"
|
||||
#endif
|
||||
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
SDL_SharedObject *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
void *handle;
|
||||
const char *loaderror;
|
||||
@ -49,10 +49,10 @@ void *SDL_LoadObject(const char *sofile)
|
||||
if (!handle) {
|
||||
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|
||||
}
|
||||
return handle;
|
||||
return (SDL_SharedObject *) handle;
|
||||
}
|
||||
|
||||
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name)
|
||||
{
|
||||
void *symbol = dlsym(handle, name);
|
||||
if (!symbol) {
|
||||
@ -72,7 +72,7 @@ SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
return symbol;
|
||||
}
|
||||
|
||||
void SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(SDL_SharedObject *handle)
|
||||
{
|
||||
if (handle) {
|
||||
dlclose(handle);
|
||||
|
@ -25,21 +25,19 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
// System dependent library loading routines
|
||||
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
SDL_SharedObject *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
const char *loaderror = "SDL_LoadObject() not implemented";
|
||||
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name)
|
||||
{
|
||||
const char *loaderror = "SDL_LoadFunction() not implemented";
|
||||
SDL_SetError("Failed loading %s: %s", name, loaderror);
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(SDL_SharedObject *handle)
|
||||
{
|
||||
// no-op.
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
SDL_SharedObject *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
if (!sofile) {
|
||||
SDL_InvalidParamError("sofile");
|
||||
@ -35,32 +35,30 @@ void *SDL_LoadObject(const char *sofile)
|
||||
}
|
||||
|
||||
LPWSTR wstr = WIN_UTF8ToStringW(sofile);
|
||||
void *handle = (void *)LoadLibrary(wstr);
|
||||
HMODULE handle = LoadLibraryW(wstr);
|
||||
SDL_free(wstr);
|
||||
|
||||
// Generate an error message if all loads failed
|
||||
if (!handle) {
|
||||
char errbuf[512];
|
||||
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
|
||||
SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf));
|
||||
SDL_snprintf(errbuf, sizeof (errbuf), "Failed loading %s", sofile);
|
||||
WIN_SetError(errbuf);
|
||||
}
|
||||
return handle;
|
||||
return (SDL_SharedObject *) handle;
|
||||
}
|
||||
|
||||
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
|
||||
SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name)
|
||||
{
|
||||
SDL_FunctionPointer symbol = (SDL_FunctionPointer)GetProcAddress((HMODULE)handle, name);
|
||||
if (!symbol) {
|
||||
char errbuf[512];
|
||||
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
|
||||
SDL_strlcat(errbuf, name, SDL_arraysize(errbuf));
|
||||
SDL_snprintf(errbuf, sizeof (errbuf), "Failed loading %s", name);
|
||||
WIN_SetError(errbuf);
|
||||
}
|
||||
return symbol;
|
||||
}
|
||||
|
||||
void SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(SDL_SharedObject *handle)
|
||||
{
|
||||
if (handle) {
|
||||
FreeLibrary((HMODULE)handle);
|
||||
|
@ -153,8 +153,8 @@ typedef struct
|
||||
// Private renderer data
|
||||
typedef struct
|
||||
{
|
||||
void *hDXGIMod;
|
||||
void *hD3D11Mod;
|
||||
SDL_SharedObject *hDXGIMod;
|
||||
SDL_SharedObject *hD3D11Mod;
|
||||
IDXGIFactory2 *dxgiFactory;
|
||||
IDXGIAdapter *dxgiAdapter;
|
||||
IDXGIDebug *dxgiDebug;
|
||||
|
@ -179,8 +179,8 @@ typedef struct
|
||||
// Private renderer data
|
||||
typedef struct
|
||||
{
|
||||
void *hDXGIMod;
|
||||
void *hD3D12Mod;
|
||||
SDL_SharedObject *hDXGIMod;
|
||||
SDL_SharedObject *hD3D12Mod;
|
||||
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
|
||||
UINT64 frameToken;
|
||||
#else
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
typedef struct STEAM_RemoteStorage
|
||||
{
|
||||
void *libsteam_api;
|
||||
SDL_SharedObject *libsteam_api;
|
||||
#define STEAM_PROC(ret, func, parms) \
|
||||
steamfntype_##func func;
|
||||
#include "SDL_steamstorage_proc.h"
|
||||
|
@ -34,7 +34,7 @@ static bool s_unwind_symbol_names = true;
|
||||
#include <dbghelp.h>
|
||||
|
||||
static struct {
|
||||
HMODULE module;
|
||||
SDL_SharedObject *module;
|
||||
BOOL (WINAPI *pSymInitialize)(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess);
|
||||
BOOL (WINAPI *pSymFromAddr)(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol);
|
||||
BOOL (WINAPI *pSymGetLineFromAddr64)(HANDLE hProcess, DWORD64 qwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
|
||||
|
@ -299,7 +299,8 @@ void SDL_EGL_UnloadLibrary(SDL_VideoDevice *_this)
|
||||
|
||||
static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_path)
|
||||
{
|
||||
void *egl_dll_handle = NULL, *opengl_dll_handle = NULL;
|
||||
SDL_SharedObject *egl_dll_handle = NULL;
|
||||
SDL_SharedObject *opengl_dll_handle = NULL;
|
||||
const char *path = NULL;
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
const char *d3dcompiler;
|
||||
|
@ -64,7 +64,8 @@ typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSy
|
||||
|
||||
typedef struct SDL_EGL_VideoData
|
||||
{
|
||||
void *opengl_dll_handle, *egl_dll_handle;
|
||||
SDL_SharedObject *opengl_dll_handle;
|
||||
SDL_SharedObject *egl_dll_handle;
|
||||
EGLDisplay egl_display;
|
||||
EGLConfig egl_config;
|
||||
int egl_swapinterval;
|
||||
|
@ -437,7 +437,7 @@ struct SDL_VideoDevice
|
||||
int egl_platform;
|
||||
int driver_loaded;
|
||||
char driver_path[256];
|
||||
void *dll_handle;
|
||||
SDL_SharedObject *dll_handle;
|
||||
} gl_config;
|
||||
|
||||
SDL_EGLAttribArrayCallback egl_platformattrib_callback;
|
||||
@ -467,7 +467,7 @@ struct SDL_VideoDevice
|
||||
SDL_FunctionPointer vkEnumerateInstanceExtensionProperties;
|
||||
int loader_loaded;
|
||||
char loader_path[256];
|
||||
void *loader_handle;
|
||||
SDL_SharedObject *loader_handle;
|
||||
} vulkan_config;
|
||||
|
||||
/* * * */
|
||||
|
@ -56,7 +56,7 @@ bool HAIKU_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||
if ( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
|
||||
&location) == B_OK) {
|
||||
|
||||
_this->gl_config.dll_handle = (void *) (addr_t) info.id;
|
||||
_this->gl_config.dll_handle = (SDL_SharedObject *) (addr_t) info.id;
|
||||
_this->gl_config.driver_loaded = 1;
|
||||
SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
|
||||
SDL_arraysize(_this->gl_config.driver_path));
|
||||
|
@ -39,7 +39,7 @@ struct SDL_VideoData
|
||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||
vdkPrivate vdk_private;
|
||||
#else
|
||||
void *egl_handle; // EGL shared library handle
|
||||
SDL_SharedObject *egl_handle; // EGL shared library handle
|
||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay)(void *context);
|
||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
|
||||
void(EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *lib;
|
||||
SDL_SharedObject *lib;
|
||||
const char *libname;
|
||||
} waylanddynlib;
|
||||
|
||||
|
@ -606,7 +606,7 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex)
|
||||
static void IME_SetupAPI(SDL_VideoData *videodata)
|
||||
{
|
||||
char ime_file[MAX_PATH + 1];
|
||||
void *hime = 0;
|
||||
SDL_SharedObject *hime = 0;
|
||||
HKL hkl = 0;
|
||||
videodata->GetReadingString = NULL;
|
||||
videodata->ShowReadingWindow = NULL;
|
||||
|
@ -393,7 +393,7 @@ static bool WIN_GetMonitorDESC1(HMONITOR hMonitor, DXGI_OUTPUT_DESC1 *desc)
|
||||
{
|
||||
typedef HRESULT (WINAPI * PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
|
||||
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL;
|
||||
void *hDXGIMod = NULL;
|
||||
SDL_SharedObject *hDXGIMod = NULL;
|
||||
bool found = false;
|
||||
|
||||
hDXGIMod = SDL_LoadObject("dxgi.dll");
|
||||
|
@ -389,7 +389,7 @@ struct SDL_VideoData
|
||||
|
||||
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // Xbox doesn't support user32/shcore
|
||||
// Touch input functions
|
||||
void *userDLL;
|
||||
SDL_SharedObject *userDLL;
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
|
||||
BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
|
||||
@ -410,7 +410,7 @@ struct SDL_VideoData
|
||||
LONG (WINAPI *DisplayConfigGetDeviceInfo)( DISPLAYCONFIG_DEVICE_INFO_HEADER*);
|
||||
/* *INDENT-ON* */ // clang-format on
|
||||
|
||||
void *shcoreDLL;
|
||||
SDL_SharedObject *shcoreDLL;
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor,
|
||||
MONITOR_DPI_TYPE dpiType,
|
||||
@ -421,7 +421,7 @@ struct SDL_VideoData
|
||||
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||
|
||||
#ifdef HAVE_DXGI_H
|
||||
void *dxgiDLL;
|
||||
SDL_SharedObject *dxgiDLL;
|
||||
IDXGIFactory *pDXGIFactory;
|
||||
#endif
|
||||
|
||||
@ -475,7 +475,7 @@ struct SDL_VideoData
|
||||
|
||||
#ifndef SDL_DISABLE_WINDOWS_IME
|
||||
HKL ime_hkl;
|
||||
void *ime_himm32;
|
||||
SDL_SharedObject *ime_himm32;
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
|
||||
BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
|
||||
|
@ -740,7 +740,7 @@ bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
|
||||
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||
// FIXME: does not work on all hardware configurations with different renders (i.e. hybrid GPUs)
|
||||
if (window->flags & SDL_WINDOW_TRANSPARENT) {
|
||||
void *handle = SDL_LoadObject("dwmapi.dll");
|
||||
SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll");
|
||||
if (handle) {
|
||||
DwmEnableBlurBehindWindow_t DwmEnableBlurBehindWindowFunc = (DwmEnableBlurBehindWindow_t)SDL_LoadFunction(handle, "DwmEnableBlurBehindWindow");
|
||||
if (DwmEnableBlurBehindWindowFunc) {
|
||||
@ -1199,7 +1199,7 @@ static DWM_WINDOW_CORNER_PREFERENCE WIN_UpdateCornerRoundingForHWND(HWND hwnd, D
|
||||
{
|
||||
DWM_WINDOW_CORNER_PREFERENCE oldPref = DWMWCP_DEFAULT;
|
||||
|
||||
void *handle = SDL_LoadObject("dwmapi.dll");
|
||||
SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll");
|
||||
if (handle) {
|
||||
DwmGetWindowAttribute_t DwmGetWindowAttributeFunc = (DwmGetWindowAttribute_t)SDL_LoadFunction(handle, "DwmGetWindowAttribute");
|
||||
DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute");
|
||||
@ -1218,7 +1218,7 @@ static COLORREF WIN_UpdateBorderColorForHWND(HWND hwnd, COLORREF colorRef)
|
||||
{
|
||||
COLORREF oldPref = DWMWA_COLOR_DEFAULT;
|
||||
|
||||
void *handle = SDL_LoadObject("dwmapi.dll");
|
||||
SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll");
|
||||
if (handle) {
|
||||
DwmGetWindowAttribute_t DwmGetWindowAttributeFunc = (DwmGetWindowAttribute_t)SDL_LoadFunction(handle, "DwmGetWindowAttribute");
|
||||
DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute");
|
||||
@ -2223,7 +2223,7 @@ bool WIN_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, bool foc
|
||||
|
||||
void WIN_UpdateDarkModeForHWND(HWND hwnd)
|
||||
{
|
||||
void *handle = SDL_LoadObject("dwmapi.dll");
|
||||
SDL_SharedObject *handle = SDL_LoadObject("dwmapi.dll");
|
||||
if (handle) {
|
||||
DwmSetWindowAttribute_t DwmSetWindowAttributeFunc = (DwmSetWindowAttribute_t)SDL_LoadFunction(handle, "DwmSetWindowAttribute");
|
||||
if (DwmSetWindowAttributeFunc) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *lib;
|
||||
SDL_SharedObject *lib;
|
||||
const char *libname;
|
||||
} x11dynlib;
|
||||
|
||||
|
@ -164,7 +164,7 @@ static void X11_GL_InitExtensions(SDL_VideoDevice *_this);
|
||||
bool X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||
{
|
||||
Display *display;
|
||||
void *handle;
|
||||
SDL_SharedObject *handle;
|
||||
|
||||
if (_this->gl_data) {
|
||||
return SDL_SetError("OpenGL context already created");
|
||||
|
@ -145,7 +145,7 @@ struct SDL_VideoData
|
||||
|
||||
#ifdef SDL_VIDEO_VULKAN
|
||||
// Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL
|
||||
void *vulkan_xlib_xcb_library;
|
||||
SDL_SharedObject *vulkan_xlib_xcb_library;
|
||||
PFN_XGetXCBConnection vulkan_XGetXCBConnection;
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@ int main(int argc, char *argv[])
|
||||
int hello = 0;
|
||||
const char *libname = NULL;
|
||||
const char *symname = NULL;
|
||||
void *lib = NULL;
|
||||
SDL_SharedObject *lib = NULL;
|
||||
fntype fn = NULL;
|
||||
SDLTest_CommonState *state;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user