src/video/x11/SDL_x11dyn.c
changeset 1235 f60f6f4ffc6f
parent 1226 d05306f0dc21
child 1236 ed252764287a
     1.1 --- a/src/video/x11/SDL_x11dyn.c	Fri Jan 06 13:20:10 2006 +0000
     1.2 +++ b/src/video/x11/SDL_x11dyn.c	Fri Jan 06 20:56:13 2006 +0000
     1.3 @@ -20,7 +20,9 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/*#define DEBUG_DYNAMIC_X11 1*/
     1.8 +#if 0
     1.9 +#define DEBUG_DYNAMIC_X11 1
    1.10 +#endif
    1.11  
    1.12  #define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
    1.13  #include "SDL_x11dyn.h"
    1.14 @@ -38,7 +40,7 @@
    1.15  static const char *x11ext_library = X11EXT_DYNAMIC;
    1.16  static void *x11ext_handle = NULL;
    1.17  
    1.18 -static void *X11_GetSym(const char *fnname, int *rc)
    1.19 +static void *X11_GetSym(int required, const char *fnname, int *rc)
    1.20  {
    1.21  	void *fn = NULL;
    1.22  	if (*rc) {  /* haven't already failed on a previous lookup? */
    1.23 @@ -57,7 +59,7 @@
    1.24  				printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
    1.25  			#endif
    1.26  		}
    1.27 -		*rc = (fn != NULL);
    1.28 +		*rc = ((fn != NULL) || (!required));
    1.29  	}
    1.30  
    1.31  	return fn;
    1.32 @@ -65,7 +67,7 @@
    1.33  #endif  /* defined X11_DYNAMIC */
    1.34  
    1.35  /* Define all the function pointers... */
    1.36 -#define SDL_X11_SYM(ret,fn,params) ret (*p##fn) params = NULL;
    1.37 +#define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL;
    1.38  #include "SDL_x11sym.h"
    1.39  #undef SDL_X11_SYM
    1.40  
    1.41 @@ -77,7 +79,7 @@
    1.42  	if (x11_load_refcount > 0) {
    1.43  		if (--x11_load_refcount == 0) {
    1.44  			/* set all the function pointers to NULL. */
    1.45 -			#define SDL_X11_SYM(ret,fn,params) p##fn = NULL;
    1.46 +			#define SDL_X11_SYM(req,ret,fn,params) p##fn = NULL;
    1.47  			#include "SDL_x11sym.h"
    1.48  			#undef SDL_X11_SYM
    1.49  
    1.50 @@ -106,7 +108,7 @@
    1.51  			x11_handle = SDL_LoadObject(x11_library);
    1.52  			x11ext_handle = SDL_LoadObject(x11ext_library);
    1.53  			rc = ((x11_handle != NULL) && (x11ext_handle != NULL));
    1.54 -			#define SDL_X11_SYM(r,fn,arg) p##fn = X11_GetSym(#fn, &rc);
    1.55 +			#define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc);
    1.56  			#include "SDL_x11sym.h"
    1.57  			#undef SDL_X11_SYM
    1.58  
    1.59 @@ -114,7 +116,7 @@
    1.60  				SDL_X11_UnloadSymbols();  /* in case one of these loaded... */
    1.61  
    1.62  		#else
    1.63 -			#define SDL_X11_SYM(r,fn,arg) p##fn = fn;
    1.64 +			#define SDL_X11_SYM(req,r,fn,arg) p##fn = fn;
    1.65  			#include "SDL_x11sym.h"
    1.66  			#undef SDL_X11_SYM
    1.67  		#endif