comparison src/video/x11/SDL_x11dyn.c @ 1659:14717b52abc0 SDL-1.3

Merge trunk-1.3-3
author Sam Lantinga <slouken@libsdl.org>
date Wed, 17 May 2006 08:18:28 +0000
parents 9f59d4c5aaea
children 782fd950bd46 9e85b267f8f3
comparison
equal deleted inserted replaced
1658:e49147870aac 1659:14717b52abc0
59 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT }, 59 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT },
60 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER }, 60 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER },
61 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR }, 61 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR },
62 }; 62 };
63 63
64 static void *X11_GetSym(const char *fnname, int *rc) 64 static void X11_GetSym(const char *fnname, int *rc, void **fn)
65 { 65 {
66 int i; 66 int i;
67 void *fn = NULL;
68 for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { 67 for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
69 if (x11libs[i].lib != NULL) 68 if (x11libs[i].lib != NULL)
70 { 69 {
71 fn = SDL_LoadFunction(x11libs[i].lib, fnname); 70 *fn = SDL_LoadFunction(x11libs[i].lib, fnname);
72 if (fn != NULL) 71 if (*fn != NULL)
73 break; 72 break;
74 } 73 }
75 } 74 }
76 75
77 #if DEBUG_DYNAMIC_X11 76 #if DEBUG_DYNAMIC_X11
78 if (fn != NULL) 77 if (*fn != NULL)
79 printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn); 78 printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, *fn);
80 else 79 else
81 printf("X11: Symbol '%s' NOT FOUND!\n", fnname); 80 printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
82 #endif 81 #endif
83 82
84 if (fn == NULL) 83 if (*fn == NULL)
85 *rc = 0; /* kill this module. */ 84 *rc = 0; /* kill this module. */
86
87 return fn;
88 } 85 }
89 86
90 87
91 /* Define all the function pointers and wrappers... */ 88 /* Define all the function pointers and wrappers... */
92 #define SDL_X11_MODULE(modname) 89 #define SDL_X11_MODULE(modname)
157 if (x11libs[i].libname != NULL) { 154 if (x11libs[i].libname != NULL) {
158 x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); 155 x11libs[i].lib = SDL_LoadObject(x11libs[i].libname);
159 } 156 }
160 } 157 }
161 #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; 158 #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
162 #define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod); 159 #define SDL_X11_SYM(a,fn,x,y,z) X11_GetSym(#fn,thismod,(void**)&p##fn);
163 #include "SDL_x11sym.h" 160 #include "SDL_x11sym.h"
164 #undef SDL_X11_MODULE 161 #undef SDL_X11_MODULE
165 #undef SDL_X11_SYM 162 #undef SDL_X11_SYM
166 163
167 #ifdef X_HAVE_UTF8_STRING 164 #ifdef X_HAVE_UTF8_STRING
168 pXCreateIC = X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8); 165 X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8,(void **)&pXCreateIC);
169 #endif 166 #endif
170 167
171 if (!SDL_X11_HAVE_BASEXLIB) { /* some required symbol didn't load. */ 168 if (!SDL_X11_HAVE_BASEXLIB) { /* some required symbol didn't load. */
172 SDL_X11_UnloadSymbols(); /* in case something got loaded... */ 169 SDL_X11_UnloadSymbols(); /* in case something got loaded... */
173 rc = 0; 170 rc = 0;