diff src/video/x11/SDL_x11dyn.c @ 1235:f60f6f4ffc6f

Make some dynamic X11 symbols option. _XData32 and _XRead32 are only available on 64-bit systems, and are chosen with macros in the X11 headers. So on 32-bit systems, it should fail to find these symbols and keep going anyhow.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 06 Jan 2006 20:56:13 +0000
parents d05306f0dc21
children ed252764287a
line wrap: on
line diff
--- a/src/video/x11/SDL_x11dyn.c	Fri Jan 06 13:20:10 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.c	Fri Jan 06 20:56:13 2006 +0000
@@ -20,7 +20,9 @@
     slouken@libsdl.org
 */
 
-/*#define DEBUG_DYNAMIC_X11 1*/
+#if 0
+#define DEBUG_DYNAMIC_X11 1
+#endif
 
 #define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
 #include "SDL_x11dyn.h"
@@ -38,7 +40,7 @@
 static const char *x11ext_library = X11EXT_DYNAMIC;
 static void *x11ext_handle = NULL;
 
-static void *X11_GetSym(const char *fnname, int *rc)
+static void *X11_GetSym(int required, const char *fnname, int *rc)
 {
 	void *fn = NULL;
 	if (*rc) {  /* haven't already failed on a previous lookup? */
@@ -57,7 +59,7 @@
 				printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
 			#endif
 		}
-		*rc = (fn != NULL);
+		*rc = ((fn != NULL) || (!required));
 	}
 
 	return fn;
@@ -65,7 +67,7 @@
 #endif  /* defined X11_DYNAMIC */
 
 /* Define all the function pointers... */
-#define SDL_X11_SYM(ret,fn,params) ret (*p##fn) params = NULL;
+#define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL;
 #include "SDL_x11sym.h"
 #undef SDL_X11_SYM
 
@@ -77,7 +79,7 @@
 	if (x11_load_refcount > 0) {
 		if (--x11_load_refcount == 0) {
 			/* set all the function pointers to NULL. */
-			#define SDL_X11_SYM(ret,fn,params) p##fn = NULL;
+			#define SDL_X11_SYM(req,ret,fn,params) p##fn = NULL;
 			#include "SDL_x11sym.h"
 			#undef SDL_X11_SYM
 
@@ -106,7 +108,7 @@
 			x11_handle = SDL_LoadObject(x11_library);
 			x11ext_handle = SDL_LoadObject(x11ext_library);
 			rc = ((x11_handle != NULL) && (x11ext_handle != NULL));
-			#define SDL_X11_SYM(r,fn,arg) p##fn = X11_GetSym(#fn, &rc);
+			#define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc);
 			#include "SDL_x11sym.h"
 			#undef SDL_X11_SYM
 
@@ -114,7 +116,7 @@
 				SDL_X11_UnloadSymbols();  /* in case one of these loaded... */
 
 		#else
-			#define SDL_X11_SYM(r,fn,arg) p##fn = fn;
+			#define SDL_X11_SYM(req,r,fn,arg) p##fn = fn;
 			#include "SDL_x11sym.h"
 			#undef SDL_X11_SYM
 		#endif