X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fgl_core44.cpp;h=8aabe9b835f1a70a98d0651739af2284c8372068;hp=4e3b51a059aaf16d449eff494c8143f13bf95850;hb=da646c739f87bf28c5a7af2bc180b93b3444321b;hpb=a851cf197844a2eb15fd5ee2c350ee296e415dca diff --git a/src/gl_core44.cpp b/src/gl_core44.cpp index 4e3b51a..8aabe9b 100644 --- a/src/gl_core44.cpp +++ b/src/gl_core44.cpp @@ -4,7 +4,21 @@ #include "gl_core44.h" #include -#define IntGetProcAddress(name) SDL_GL_GetProcAddress(name) + +// Casting between function and data pointers is invalid C++ (but we need to +// do it for OpenGL to work at all (yay!), so use gcc __extension__ operator +// to silence warnings and errors here. +typedef void (*func_ptr)(); + +func_ptr IntGetProcAddress(const char *name) +{ +#ifdef __GNUC__ + __extension__ func_ptr fn = reinterpret_cast(SDL_GL_GetProcAddress(name)); + return fn; +#else + return (func_ptr)SDL_GL_GetProcAddress(name); +#endif +} int ogl_ext_NV_texture_barrier = ogl_LOAD_FAILED; int ogl_ext_NV_copy_image = ogl_LOAD_FAILED; @@ -1771,7 +1785,7 @@ static int Load_Version_4_4() typedef int (*PFN_LOADFUNCPOINTERS)(); typedef struct ogl_StrToExtMap_s { - char *extensionName; + const char *extensionName; int *extensionVariable; PFN_LOADFUNCPOINTERS LoadExtension; } ogl_StrToExtMap;