comparison src/video/x11/SDL_x11dyn.c @ 1361:19418e4422cb

New configure-based build system. Still work in progress, but much improved
author Sam Lantinga <slouken@libsdl.org>
date Thu, 16 Feb 2006 10:11:48 +0000
parents fe7d081a4955
children d910939febfa
comparison
equal deleted inserted replaced
1360:70a9cfb4cf1b 1361:19418e4422cb
22 22
23 #if 0 23 #if 0
24 #define DEBUG_DYNAMIC_X11 1 24 #define DEBUG_DYNAMIC_X11 1
25 #endif 25 #endif
26 26
27 #include "SDL_config.h"
28
27 #define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1 29 #define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
28 #include "SDL_x11dyn.h" 30 #include "SDL_x11dyn.h"
29 31
30 #ifdef DEBUG_DYNAMIC_X11 32 #ifdef DEBUG_DYNAMIC_X11
31 #include <stdio.h> 33 #include <stdio.h>
32 #endif 34 #endif
33 35
34 #ifdef X11_DYNAMIC 36 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
35 #include <dlfcn.h> 37 #include <dlfcn.h>
36 #include "SDL_name.h" 38 #include "SDL_name.h"
37 #include "SDL_loadso.h" 39 #include "SDL_loadso.h"
38 static const char *x11_library = X11_DYNAMIC; 40 static const char *x11_library = SDL_VIDEO_DRIVER_X11_DYNAMIC;
39 static void *x11_handle = NULL; 41 static void *x11_handle = NULL;
40 static const char *x11ext_library = X11EXT_DYNAMIC; 42 static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT;
41 static void *x11ext_handle = NULL; 43 static void *x11ext_handle = NULL;
42 44
43 static void *X11_GetSym(int required, const char *fnname, int *rc) 45 static void *X11_GetSym(int required, const char *fnname, int *rc)
44 { 46 {
45 void *fn = NULL; 47 void *fn = NULL;
63 *rc = ((fn != NULL) || (!required)); 65 *rc = ((fn != NULL) || (!required));
64 } 66 }
65 67
66 return fn; 68 return fn;
67 } 69 }
68 #endif /* defined X11_DYNAMIC */ 70 #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
69 71
70 /* Define all the function pointers... */ 72 /* Define all the function pointers... */
71 #define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL; 73 #define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL;
72 #include "SDL_x11sym.h" 74 #include "SDL_x11sym.h"
73 #undef SDL_X11_SYM 75 #undef SDL_X11_SYM
82 /* set all the function pointers to NULL. */ 84 /* set all the function pointers to NULL. */
83 #define SDL_X11_SYM(req,ret,fn,params) p##fn = NULL; 85 #define SDL_X11_SYM(req,ret,fn,params) p##fn = NULL;
84 #include "SDL_x11sym.h" 86 #include "SDL_x11sym.h"
85 #undef SDL_X11_SYM 87 #undef SDL_X11_SYM
86 88
87 #ifdef X11_DYNAMIC 89 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
88 if (x11_handle != NULL) { 90 if (x11_handle != NULL) {
89 SDL_UnloadObject(x11_handle); 91 SDL_UnloadObject(x11_handle);
90 x11_handle = NULL; 92 x11_handle = NULL;
91 } 93 }
92 if (x11ext_handle != NULL) { 94 if (x11ext_handle != NULL) {
103 { 105 {
104 int rc = 1; 106 int rc = 1;
105 107
106 /* deal with multiple modules (dga, x11, etc) needing these symbols... */ 108 /* deal with multiple modules (dga, x11, etc) needing these symbols... */
107 if (x11_load_refcount++ == 0) { 109 if (x11_load_refcount++ == 0) {
108 #ifdef X11_DYNAMIC 110 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
109 x11_handle = SDL_LoadObject(x11_library); 111 x11_handle = SDL_LoadObject(x11_library);
110 x11ext_handle = SDL_LoadObject(x11ext_library); 112 x11ext_handle = SDL_LoadObject(x11ext_library);
111 rc = ((x11_handle != NULL) && (x11ext_handle != NULL)); 113 rc = ((x11_handle != NULL) && (x11ext_handle != NULL));
112 #define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc); 114 #define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc);
113 #include "SDL_x11sym.h" 115 #include "SDL_x11sym.h"