v3: dynamic loading of the SDL library
Signed-off-by: Aric Stewart aric@codeweavers.com --- dlls/winebus.sys/bus_sdl.c | 300 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 299 insertions(+), 1 deletion(-)
Aric Stewart aric@codeweavers.com writes:
+#ifdef SONAME_LIBSDL2 +#define MAKE_FUNCPTR(f) static typeof(f) * p##f = NULL +MAKE_FUNCPTR(SDL_GetError); +MAKE_FUNCPTR(SDL_Init); +MAKE_FUNCPTR(SDL_JoystickEventState); +MAKE_FUNCPTR(SDL_JoystickGetGUID); +MAKE_FUNCPTR(SDL_JoystickGetGUIDString); +#ifdef HAVE_SDL_VIDPID +MAKE_FUNCPTR(SDL_JoystickGetProduct); +MAKE_FUNCPTR(SDL_JoystickGetProductVersion); +MAKE_FUNCPTR(SDL_JoystickGetVendor); +#endif
Now that you are loading the library dynamically, HAVE_SDL_VIDPID should be replaced by a run-time check for the necessary functions (note that you may need to declare the prototypes explicitly if they are missing from the header).
Ok yes, they are missing from the header so I was unsure what the proper approach was for that.
Is there a good example of the explicit prototype I could follow?
thanks! -aric
On 2/20/18 1:47 PM, Alexandre Julliard wrote:
Aric Stewart aric@codeweavers.com writes:
+#ifdef SONAME_LIBSDL2 +#define MAKE_FUNCPTR(f) static typeof(f) * p##f = NULL +MAKE_FUNCPTR(SDL_GetError); +MAKE_FUNCPTR(SDL_Init); +MAKE_FUNCPTR(SDL_JoystickEventState); +MAKE_FUNCPTR(SDL_JoystickGetGUID); +MAKE_FUNCPTR(SDL_JoystickGetGUIDString); +#ifdef HAVE_SDL_VIDPID +MAKE_FUNCPTR(SDL_JoystickGetProduct); +MAKE_FUNCPTR(SDL_JoystickGetProductVersion); +MAKE_FUNCPTR(SDL_JoystickGetVendor); +#endif
Now that you are loading the library dynamically, HAVE_SDL_VIDPID should be replaced by a run-time check for the necessary functions (note that you may need to declare the prototypes explicitly if they are missing from the header).
Aric Stewart aric@codeweavers.com writes:
Ok yes, they are missing from the header so I was unsure what the proper approach was for that.
Is there a good example of the explicit prototype I could follow?
For instance there's pFT_Outline_Embolden in dlls/gdi32/freetype.c.