diff -r 6d44d9a589e1 include/SDL_loadso.h --- a/include/SDL_loadso.h Wed Jun 06 09:42:12 2018 -0700 +++ b/include/SDL_loadso.h Wed Jun 06 18:56:03 2018 -0700 @@ -62,8 +62,8 @@ * named function in the shared object and returns it. This address * is no longer valid after calling SDL_UnloadObject(). */ -extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, - const char *name); +extern DECLSPEC SDL_FunctionPointer SDL_LoadFunction(void *handle, + const char *name); /** * Unload a shared object from memory. diff -r 6d44d9a589e1 include/SDL_stdinc.h --- a/include/SDL_stdinc.h Wed Jun 06 09:42:12 2018 -0700 +++ b/include/SDL_stdinc.h Wed Jun 06 18:56:03 2018 -0700 @@ -593,6 +593,8 @@ return SDL_memcpy(dst, src, dwords * 4); } +typedef void (SDLCALL *SDL_FunctionPointer)(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff -r 6d44d9a589e1 include/SDL_video.h --- a/include/SDL_video.h Wed Jun 06 09:42:12 2018 -0700 +++ b/include/SDL_video.h Wed Jun 06 18:56:03 2018 -0700 @@ -1113,7 +1113,7 @@ /** * \brief Get the address of an OpenGL function. */ -extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); +extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char *proc); /** * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). diff -r 6d44d9a589e1 include/SDL_vulkan.h --- a/include/SDL_vulkan.h Wed Jun 06 09:42:12 2018 -0700 +++ b/include/SDL_vulkan.h Wed Jun 06 18:56:03 2018 -0700 @@ -52,6 +52,9 @@ VK_DEFINE_HANDLE(VkInstance) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) +//typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); +//typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); + #endif /* !NO_SDL_VULKAN_TYPEDEFS */ typedef VkInstance SDL_vulkanInstance; @@ -121,7 +124,8 @@ * \note This should be called after either calling SDL_Vulkan_LoadLibrary * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. */ -extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); +//extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); +extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); /** * \brief Unload the Vulkan loader library previously loaded by diff -r 6d44d9a589e1 src/dynapi/SDL_dynapi_procs.h --- a/src/dynapi/SDL_dynapi_procs.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/dynapi/SDL_dynapi_procs.h Wed Jun 06 18:56:03 2018 -0700 @@ -261,7 +261,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_LoadFunction,(void *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),) SDL_DYNAPI_PROC(void,SDL_LogSetAllPriority,(SDL_LogPriority a),(a),) SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),) @@ -579,7 +579,7 @@ SDL_DYNAPI_PROC(void,SDL_EnableScreenSaver,(void),(),) SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),) SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_GL_GetProcAddress,(const char *a),(a),return) +SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_GL_GetProcAddress,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return) @@ -664,7 +664,7 @@ SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) +SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) diff -r 6d44d9a589e1 src/loadso/dlopen/SDL_sysloadso.c --- a/src/loadso/dlopen/SDL_sysloadso.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/loadso/dlopen/SDL_sysloadso.c Wed Jun 06 18:56:03 2018 -0700 @@ -55,7 +55,7 @@ return (handle); } -void * +SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name) { void *symbol = dlsym(handle, name); diff -r 6d44d9a589e1 src/render/opengl/SDL_render_gl.c --- a/src/render/opengl/SDL_render_gl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/render/opengl/SDL_render_gl.c Wed Jun 06 18:56:03 2018 -0700 @@ -272,7 +272,7 @@ #else #define SDL_PROC(ret,func,params) \ do { \ - data->func = SDL_GL_GetProcAddress(#func); \ + data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ diff -r 6d44d9a589e1 src/render/opengles2/SDL_render_gles2.c --- a/src/render/opengles2/SDL_render_gles2.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/render/opengles2/SDL_render_gles2.c Wed Jun 06 18:56:03 2018 -0700 @@ -294,7 +294,7 @@ #else #define SDL_PROC(ret,func,params) \ do { \ - data->func = SDL_GL_GetProcAddress(#func); \ + data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ diff -r 6d44d9a589e1 src/video/SDL_egl.c --- a/src/video/SDL_egl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/SDL_egl.c Wed Jun 06 18:56:03 2018 -0700 @@ -82,11 +82,11 @@ #endif /* SDL_VIDEO_DRIVER_RPI */ #ifdef SDL_VIDEO_STATIC_ANGLE -#define LOAD_FUNC(NAME) \ -_this->egl_data->NAME = (void *)NAME; +#define LOAD_FUNC(TYPE, NAME) \ +_this->egl_data->NAME = NAME; #else -#define LOAD_FUNC(NAME) \ -_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ +#define LOAD_FUNC(TYPE,NAME) \ +_this->egl_data->NAME = (TYPE)SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ @@ -206,7 +206,7 @@ return SDL_FALSE; } -void * +SDL_FunctionPointer SDL_EGL_GetProcAddress(_THIS, const char *proc) { static char procname[1024]; @@ -374,6 +374,26 @@ _this->egl_data->dll_handle = dll_handle; /* Load new function pointers */ + LOAD_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); + LOAD_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); + LOAD_FUNC(PFNEGLTERMINATEPROC, eglTerminate); + LOAD_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); + LOAD_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); + LOAD_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); + LOAD_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); + LOAD_FUNC(PFNEGLCREATEPBUFFERSURFACEPROC, eglCreatePbufferSurface); + LOAD_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); + LOAD_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); + LOAD_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); + LOAD_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); + LOAD_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); + LOAD_FUNC(PFNEGLQUERYSTRINGPROC, eglQueryString); + LOAD_FUNC(PFNEGLGETCONFIGATTRIBPROC, eglGetConfigAttrib); + LOAD_FUNC(PFNEGLWAITNATIVEPROC, eglWaitNative); + LOAD_FUNC(PFNEGLWAITGLPROC, eglWaitGL); + LOAD_FUNC(PFNEGLBINDAPIPROC, eglBindAPI); + LOAD_FUNC(PFNEGLGETERRORPROC, eglGetError); +#if 0 LOAD_FUNC(eglGetDisplay); LOAD_FUNC(eglInitialize); LOAD_FUNC(eglTerminate); @@ -393,7 +413,7 @@ LOAD_FUNC(eglBindAPI); LOAD_FUNC(eglQueryString); LOAD_FUNC(eglGetError); - +#endif if (_this->egl_data->eglQueryString) { /* EGL 1.5 allows querying for client version */ const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION); @@ -407,7 +427,8 @@ } if (egl_version_major == 1 && egl_version_minor == 5) { - LOAD_FUNC(eglGetPlatformDisplay); + LOAD_FUNC(PFNEGLGETPLATFORMDISPLAYEXTPROC, eglGetPlatformDisplay); + //LOAD_FUNC(eglGetPlatformDisplay); } _this->egl_data->egl_display = EGL_NO_DISPLAY; @@ -417,7 +438,7 @@ _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL); } else { if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) { - _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT"); + _this->egl_data->eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT"); if (_this->egl_data->eglGetPlatformDisplayEXT) { _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL); } diff -r 6d44d9a589e1 src/video/SDL_egl_c.h --- a/src/video/SDL_egl_c.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/SDL_egl_c.h Wed Jun 06 18:56:03 2018 -0700 @@ -29,6 +29,45 @@ #include "SDL_sysvideo.h" +/* Doing this rather than using the ../render/SDL_glfuncs.h model because of + * the overhead of adding a new file due to the many types of project file. */ +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (NativeDisplayType display); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint * major, EGLint * minor); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy); +typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char * procName); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, + const EGLint * attrib_list, + EGLConfig * configs, + EGLint config_size, + EGLint * num_config); +typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, + EGLConfig config, + EGLContext share_list, + const EGLint * attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay dpy, + EGLConfig config, + EGLint const* attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, + EGLConfig config, + NativeWindowType window, + const EGLint * attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface draw); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval); +typedef const char * (EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name); + +typedef EGLBoolean(EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, + EGLConfig config, + EGLint attribute, + EGLint * value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum); +typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void); + typedef struct SDL_EGL_VideoData { void *egl_dll_handle, *dll_handle; @@ -37,60 +76,27 @@ int egl_swapinterval; int egl_surfacetype; - EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); - EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, - void *native_display, - const EGLint *attrib_list); - EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform, - void *native_display, - const EGLint *attrib_list); - EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, - EGLint * minor); - EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); - - void *(EGLAPIENTRY *eglGetProcAddress) (const char * procName); - - EGLBoolean(EGLAPIENTRY *eglChooseConfig) (EGLDisplay dpy, - const EGLint * attrib_list, - EGLConfig * configs, - EGLint config_size, EGLint * num_config); - - EGLContext(EGLAPIENTRY *eglCreateContext) (EGLDisplay dpy, - EGLConfig config, - EGLContext share_list, - const EGLint * attrib_list); - - EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); - - EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, - EGLint const* attrib_list); - - EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy, - EGLConfig config, - NativeWindowType window, - const EGLint * attrib_list); - EGLBoolean(EGLAPIENTRY *eglDestroySurface) (EGLDisplay dpy, EGLSurface surface); - - EGLBoolean(EGLAPIENTRY *eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx); - - EGLBoolean(EGLAPIENTRY *eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw); - - EGLBoolean(EGLAPIENTRY *eglSwapInterval) (EGLDisplay dpy, EGLint interval); - - const char *(EGLAPIENTRY *eglQueryString) (EGLDisplay dpy, EGLint name); - - EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint * value); - - EGLBoolean(EGLAPIENTRY *eglWaitNative) (EGLint engine); - - EGLBoolean(EGLAPIENTRY *eglWaitGL)(void); - - EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); - - EGLint(EGLAPIENTRY *eglGetError)(void); - + PFNEGLGETDISPLAYPROC eglGetDisplay; + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplay; + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; + PFNEGLINITIALIZEPROC eglInitialize; + PFNEGLTERMINATEPROC eglTerminate; + PFNEGLGETPROCADDRESSPROC eglGetProcAddress; + PFNEGLCHOOSECONFIGPROC eglChooseConfig; + PFNEGLCREATECONTEXTPROC eglCreateContext; + PFNEGLDESTROYCONTEXTPROC eglDestroyContext; + PFNEGLCREATEPBUFFERSURFACEPROC eglCreatePbufferSurface; + PFNEGLCREATEWINDOWSURFACEPROC eglCreateWindowSurface; + PFNEGLDESTROYSURFACEPROC eglDestroySurface; + PFNEGLMAKECURRENTPROC eglMakeCurrent; + PFNEGLSWAPBUFFERSPROC eglSwapBuffers; + PFNEGLSWAPINTERVALPROC eglSwapInterval; + PFNEGLQUERYSTRINGPROC eglQueryString; + PFNEGLGETCONFIGATTRIBPROC eglGetConfigAttrib; + PFNEGLWAITNATIVEPROC eglWaitNative; + PFNEGLWAITGLPROC eglWaitGL; + PFNEGLBINDAPIPROC eglBindAPI; + PFNEGLGETERRORPROC eglGetError; } SDL_EGL_VideoData; /* OpenGLES functions */ @@ -99,7 +105,7 @@ * or, if 0 is passed, let the implementation decide. */ extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); -extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer SDL_EGL_GetProcAddress(_THIS, const char *proc); extern void SDL_EGL_UnloadLibrary(_THIS); extern int SDL_EGL_ChooseConfig(_THIS); extern int SDL_EGL_SetSwapInterval(_THIS, int interval); diff -r 6d44d9a589e1 src/video/SDL_sysvideo.h --- a/src/video/SDL_sysvideo.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/SDL_sysvideo.h Wed Jun 06 18:56:03 2018 -0700 @@ -252,9 +252,9 @@ * OpenGL support */ int (*GL_LoadLibrary) (_THIS, const char *path); - void *(*GL_GetProcAddress) (_THIS, const char *proc); + SDL_FunctionPointer (*GL_GetProcAddress) (_THIS, const char *proc); void (*GL_UnloadLibrary) (_THIS); - SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window); + SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window); int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context); void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); int (*GL_SetSwapInterval) (_THIS, int interval); diff -r 6d44d9a589e1 src/video/SDL_video.c --- a/src/video/SDL_video.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/SDL_video.c Wed Jun 06 18:56:03 2018 -0700 @@ -2813,7 +2813,7 @@ return (retval); } -void * +SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc) { void *func; @@ -2860,11 +2860,20 @@ } #endif +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void); + typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint * params); + typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name); + #if !SDL_VIDEO_OPENGL + typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); + #endif +#endif + SDL_bool SDL_GL_ExtensionSupported(const char *extension) { #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 - const GLubyte *(APIENTRY * glGetStringFunc) (GLenum); + PFNGLGETSTRINGPROC glGetStringFunc; const char *extensions; const char *start; const char *where, *terminator; @@ -2882,19 +2891,21 @@ /* Lookup the available extensions */ - glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); + glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { return SDL_FALSE; } if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { - const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint); - void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); + PFNGLGETSTRINGIPROC glGetStringiFunc; + PFNGLGETINTEGERVPROC glGetIntegervFunc; GLint num_exts = 0; GLint i; - glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi"); - glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); + glGetStringiFunc + = (PFNGLGETSTRINGIPROC)SDL_GL_GetProcAddress("glGetStringi"); + glGetIntegervFunc + = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv"); if ((!glGetStringiFunc) || (!glGetIntegervFunc)) { return SDL_FALSE; } @@ -3154,7 +3165,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) { #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 - GLenum (APIENTRY *glGetErrorFunc) (void); + PFNGLGETERRORPROC glGetErrorFunc; GLenum attrib = 0; GLenum error = 0; @@ -3165,8 +3176,8 @@ * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2. */ #if SDL_VIDEO_OPENGL - const GLubyte *(APIENTRY *glGetStringFunc) (GLenum name); - void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params); + PFNGLGETSTRINGPROC glGetStringFunc; + PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameterivFunc; GLenum attachment = GL_BACK_LEFT; GLenum attachmentattrib = 0; #endif @@ -3354,13 +3365,13 @@ } #if SDL_VIDEO_OPENGL - glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); + glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { return -1; } if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { - glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv"); + glGetFramebufferAttachmentParameterivFunc = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv"); if (glGetFramebufferAttachmentParameterivFunc) { glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value); @@ -3371,7 +3382,7 @@ #endif { void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params); - glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); + glGetIntegervFunc = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv"); if (glGetIntegervFunc) { glGetIntegervFunc(attrib, (GLint *) value); } else { @@ -3379,7 +3390,7 @@ } } - glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); + glGetErrorFunc = (PFNGLGETERRORPROC)SDL_GL_GetProcAddress("glGetError"); if (!glGetErrorFunc) { return -1; } @@ -4009,7 +4020,7 @@ return retval; } -void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) +SDL_FunctionPointer SDL_Vulkan_GetVkGetInstanceProcAddr(void) { if (!_this) { SDL_UninitializedVideo(); @@ -4019,7 +4030,7 @@ SDL_SetError("No Vulkan loader has been loaded"); return NULL; } - return _this->vulkan_config.vkGetInstanceProcAddr; + return (SDL_FunctionPointer)_this->vulkan_config.vkGetInstanceProcAddr; } void SDL_Vulkan_UnloadLibrary(void) diff -r 6d44d9a589e1 src/video/cocoa/SDL_cocoaopengl.h --- a/src/video/cocoa/SDL_cocoaopengl.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/cocoa/SDL_cocoaopengl.h Wed Jun 06 18:56:03 2018 -0700 @@ -49,7 +49,7 @@ /* OpenGL functions */ extern int Cocoa_GL_LoadLibrary(_THIS, const char *path); -extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc); extern void Cocoa_GL_UnloadLibrary(_THIS); extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window); extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, diff -r 6d44d9a589e1 src/video/cocoa/SDL_cocoaopengl.m --- a/src/video/cocoa/SDL_cocoaopengl.m Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/cocoa/SDL_cocoaopengl.m Wed Jun 06 18:56:03 2018 -0700 @@ -136,7 +136,7 @@ return 0; } -void * +SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc) { return SDL_LoadFunction(_this->gl_config.dll_handle, proc); diff -r 6d44d9a589e1 src/video/directfb/SDL_DirectFB_opengl.c --- a/src/video/directfb/SDL_DirectFB_opengl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/directfb/SDL_DirectFB_opengl.c Wed Jun 06 18:56:03 2018 -0700 @@ -160,7 +160,7 @@ _this->gl_data = NULL; } -void * +SDL_FunctionPointer DirectFB_GL_GetProcAddress(_THIS, const char *proc) { void *handle; diff -r 6d44d9a589e1 src/video/directfb/SDL_DirectFB_opengl.h --- a/src/video/directfb/SDL_DirectFB_opengl.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/directfb/SDL_DirectFB_opengl.h Wed Jun 06 18:56:03 2018 -0700 @@ -44,7 +44,7 @@ extern void DirectFB_GL_Shutdown(_THIS); extern int DirectFB_GL_LoadLibrary(_THIS, const char *path); -extern void *DirectFB_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer DirectFB_GL_GetProcAddress(_THIS, const char *proc); extern SDL_GLContext DirectFB_GL_CreateContext(_THIS, SDL_Window * window); extern int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); diff -r 6d44d9a589e1 src/video/haiku/SDL_bopengl.h --- a/src/video/haiku/SDL_bopengl.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/haiku/SDL_bopengl.h Wed Jun 06 18:56:03 2018 -0700 @@ -31,8 +31,8 @@ #include "../SDL_sysvideo.h" -extern int BE_GL_LoadLibrary(_THIS, const char *path); /* FIXME */ -extern void *BE_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */ +extern int BE_GL_LoadLibrary(_THIS, const char *path); /* FIXME */ +extern SDL_FunctionPointer BE_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */ extern void BE_GL_UnloadLibrary(_THIS); /* TODO */ extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); diff -r 6d44d9a589e1 src/video/psp/SDL_pspgl.c --- a/src/video/psp/SDL_pspgl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/psp/SDL_pspgl.c Wed Jun 06 18:56:03 2018 -0700 @@ -56,7 +56,7 @@ GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) */ -void * +SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc) { return eglGetProcAddress(proc); diff -r 6d44d9a589e1 src/video/psp/SDL_pspgl_c.h --- a/src/video/psp/SDL_pspgl_c.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/psp/SDL_pspgl_c.h Wed Jun 06 18:56:03 2018 -0700 @@ -36,7 +36,7 @@ uint32_t swapinterval; }SDL_GLDriverData; -extern void * PSP_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc); extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); extern void PSP_GL_SwapBuffers(_THIS); diff -r 6d44d9a589e1 src/video/psp/SDL_pspvideo.h --- a/src/video/psp/SDL_pspvideo.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/psp/SDL_pspvideo.h Wed Jun 06 18:56:03 2018 -0700 @@ -82,7 +82,7 @@ /* OpenGL/OpenGL ES functions */ int PSP_GL_LoadLibrary(_THIS, const char *path); -void *PSP_GL_GetProcAddress(_THIS, const char *proc); +SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc); void PSP_GL_UnloadLibrary(_THIS); SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); diff -r 6d44d9a589e1 src/video/uikit/SDL_uikitopengles.h --- a/src/video/uikit/SDL_uikitopengles.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/uikit/SDL_uikitopengles.h Wed Jun 06 18:56:03 2018 -0700 @@ -30,7 +30,7 @@ extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window); extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context); -extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer UIKit_GL_GetProcAddress(_THIS, const char *proc); extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern void UIKit_GL_RestoreCurrentContext(void); diff -r 6d44d9a589e1 src/video/uikit/SDL_uikitopengles.m --- a/src/video/uikit/SDL_uikitopengles.m Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/uikit/SDL_uikitopengles.m Wed Jun 06 18:56:03 2018 -0700 @@ -52,7 +52,7 @@ @end -void * +SDL_FunctionPointer UIKit_GL_GetProcAddress(_THIS, const char *proc) { /* Look through all SO's for the proc symbol. Here's why: diff -r 6d44d9a589e1 src/video/windows/SDL_windowsopengl.c --- a/src/video/windows/SDL_windowsopengl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/windows/SDL_windowsopengl.c Wed Jun 06 18:56:03 2018 -0700 @@ -178,7 +178,7 @@ return 0; } -void * +SDL_FunctionPointer WIN_GL_GetProcAddress(_THIS, const char *proc) { void *func; diff -r 6d44d9a589e1 src/video/windows/SDL_windowsopengl.h --- a/src/video/windows/SDL_windowsopengl.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/windows/SDL_windowsopengl.h Wed Jun 06 18:56:03 2018 -0700 @@ -42,7 +42,7 @@ int minor; } es_profile_max_supported_version; - void *(WINAPI * wglGetProcAddress) (const char *proc); + PROC (WINAPI * wglGetProcAddress) (const char *proc); HGLRC(WINAPI * wglCreateContext) (HDC hdc); BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); @@ -64,7 +64,7 @@ /* OpenGL functions */ extern int WIN_GL_LoadLibrary(_THIS, const char *path); -extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer WIN_GL_GetProcAddress(_THIS, const char *proc); extern void WIN_GL_UnloadLibrary(_THIS); extern SDL_bool WIN_GL_UseEGL(_THIS); extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); diff -r 6d44d9a589e1 src/video/x11/SDL_x11opengl.c --- a/src/video/x11/SDL_x11opengl.c Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/x11/SDL_x11opengl.c Wed Jun 06 18:56:03 2018 -0700 @@ -265,7 +265,7 @@ return 0; } -void * +SDL_FunctionPointer X11_GL_GetProcAddress(_THIS, const char *proc) { if (_this->gl_data->glXGetProcAddress) { diff -r 6d44d9a589e1 src/video/x11/SDL_x11opengl.h --- a/src/video/x11/SDL_x11opengl.h Wed Jun 06 09:42:12 2018 -0700 +++ b/src/video/x11/SDL_x11opengl.h Wed Jun 06 18:56:03 2018 -0700 @@ -48,7 +48,7 @@ } es_profile_max_supported_version; Bool (*glXQueryExtension) (Display*,int*,int*); - void *(*glXGetProcAddress) (const GLubyte*); + SDL_FunctionPointer (*glXGetProcAddress) (const GLubyte*); XVisualInfo *(*glXChooseVisual) (Display*,int,int*); GLXContext (*glXCreateContext) (Display*,XVisualInfo*,GLXContext,Bool); GLXContext (*glXCreateContextAttribsARB) (Display*,GLXFBConfig,GLXContext,Bool,const int *); @@ -65,7 +65,7 @@ /* OpenGL functions */ extern int X11_GL_LoadLibrary(_THIS, const char *path); -extern void *X11_GL_GetProcAddress(_THIS, const char *proc); +extern SDL_FunctionPointer X11_GL_GetProcAddress(_THIS, const char *proc); extern void X11_GL_UnloadLibrary(_THIS); extern SDL_bool X11_GL_UseEGL(_THIS); extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen); diff -r 6d44d9a589e1 test/testgl2.c --- a/test/testgl2.c Wed Jun 06 09:42:12 2018 -0700 +++ b/test/testgl2.c Wed Jun 06 18:56:03 2018 -0700 @@ -54,7 +54,7 @@ #else #define SDL_PROC(ret,func,params) \ do { \ - data->func = SDL_GL_GetProcAddress(#func); \ + data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \