Changeset 91
- Timestamp:
- 02/26/05 11:49:30 (4 years ago)
- Files:
-
- trunk/DerelictAL/Makefile (modified) (1 diff)
- trunk/DerelictAL/derelict/openal/al.d (modified) (3 diffs)
- trunk/DerelictGL/Makefile (modified) (1 diff)
- trunk/DerelictGL/derelict/opengl/gl.d (modified) (1 diff)
- trunk/DerelictGL/derelict/opengl/internal.d (modified) (1 diff)
- trunk/DerelictGLFW/Makefile (modified) (1 diff)
- trunk/DerelictGLFW/derelict/glfw/glfw.d (modified) (2 diffs)
- trunk/DerelictSDL/Makefile (modified) (1 diff)
- trunk/DerelictSDL/Makefile.linux (modified) (1 diff)
- trunk/DerelictSDL/derelict/sdl/sdl.d (modified) (4 diffs)
- trunk/DerelictSDLImage/Makefile (modified) (1 diff)
- trunk/DerelictSDLImage/Makefile.linux (modified) (1 diff)
- trunk/DerelictSDLImage/derelict/sdl/image.d (modified) (4 diffs)
- trunk/DerelictSDLMixer/Makefile (modified) (1 diff)
- trunk/DerelictSDLMixer/Makefile.linux (modified) (1 diff)
- trunk/DerelictSDLMixer/derelict/sdl/mixer.d (modified) (4 diffs)
- trunk/DerelictSDLNet/Makefile (modified) (1 diff)
- trunk/DerelictSDLNet/Makefile.linux (modified) (1 diff)
- trunk/DerelictSDLNet/derelict/sdl/net.d (modified) (4 diffs)
- trunk/DerelictSDLttf/Makefile (modified) (1 diff)
- trunk/DerelictSDLttf/Makefile.linux (modified) (1 diff)
- trunk/DerelictSDLttf/derelict/sdl/ttf.d (modified) (4 diffs)
- trunk/DerelictUtil (added)
- trunk/DerelictUtil/Makefile (added)
- trunk/DerelictUtil/derelict (added)
- trunk/DerelictUtil/derelict/util (added)
- trunk/DerelictUtil/derelict/util/exception.d (added)
- trunk/DerelictUtil/derelict/util/loader.d (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/DerelictAL/Makefile
r74 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) 8 DINC = -I$(SRC.DIR) -I..\DerelictUtil 9 9 10 10 OAL.SRC.DIR = $(SRC.DIR)\derelict\openal trunk/DerelictAL/derelict/openal/al.d
r90 r91 144 144 // Loader 145 145 //============================================================================== 146 private import std.loader; 147 148 private HXModule hal; 149 private bit exeModuleInited = false; 150 151 private void* getProc(char[] procname) 152 { 153 void *symbol = ExeModule_GetSymbol(hal, procname); 154 if(symbol is null) 155 throw new Exception("Failed to load openal proc address " ~ procname); 156 return symbol; 146 private import derelict.util.loader; 147 148 private SharedLib libAL; 149 150 private void* getProc(char[] procName) 151 { 152 return Derelict_GetProc(libAL, procName); 157 153 } 158 154 … … 225 221 public void DerelictAL_Load(char[] libName) 226 222 { 227 if( hal!== null)223 if(libAL !== null) 228 224 return; 229 225 230 if(ExeModule_Init() == -1) 231 throw new Exception("Exemodule initialization failed"); 232 233 exeModuleInited = true; 234 235 hal = ExeModule_Load(libName); 236 237 if(hal is null) 238 throw new Exception("Failed to load the OpenAL shared library."); 239 226 libAL = Derelict_LoadSharedLib(libName); 240 227 loadAL(); 241 228 } … … 245 232 version(Windows) 246 233 DerelictAL_Load("OpenAL32.dll"); 234 version(linux) 235 DerelictAL_Load("libal.so"); 247 236 } 248 237 249 238 public void DerelictAL_Unload() 250 239 { 251 if(hal !== null) 252 ExeModule_Release(hal); 253 if(exeModuleInited) 254 { 255 ExeModule_Uinit(); 256 exeModuleInited = false; 257 } 240 Derelict_UnloadSharedLib(libAL); 258 241 } 259 242 trunk/DerelictGL/Makefile
r82 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) 8 DINC = -I$(SRC.DIR) -I..\DerelictUtil 9 9 10 10 OGL.SRC.DIR = $(SRC.DIR)\derelict\opengl trunk/DerelictGL/derelict/opengl/gl.d
r90 r91 58 58 public void DerelictGL_Unload() 59 59 { 60 internal Cleanup();60 internalUnload(); 61 61 } 62 62 trunk/DerelictGL/derelict/opengl/internal.d
r90 r91 1 1 module derelict.opengl.internal; 2 2 3 private import std.loader;3 private import derelict.util.loader; 4 4 5 private HXModule hlib; 6 private bit exeModuleInited = false; 5 private SharedLib libGL; 7 6 8 package void* getProc(char[] proc name)7 package void* getProc(char[] procName) 9 8 { 10 void *symbol = ExeModule_GetSymbol(hlib, procname); 11 if(symbol is null) 12 throw new Exception("Failed to load shared library proc address " ~ procname); 13 return symbol; 9 return Derelict_GetProc(libGL, procName); 14 10 } 15 11 16 12 package void internalLoad(char[] libName) 17 13 { 18 if( hlib!== null)14 if(libGL !== null) 19 15 return; 20 16 21 if(ExeModule_Init() == -1) 22 throw new Exception("ExeModule initialization failed"); 23 24 exeModuleInited = true; 25 26 hlib = ExeModule_Load(libName); 27 28 if(hlib is null) 29 throw new Exception("Failed to load the shared library " ~ libName); 30 17 libGL = Derelict_LoadSharedLib(libName); 31 18 } 32 19 33 package void internal Cleanup()20 package void internalUnload() 34 21 { 35 if(hlib !== null) 36 ExeModule_Release(hlib); 37 if(exeModuleInited) 38 { 39 ExeModule_Uninit(); 40 exeModuleInited = false; 41 } 22 Derelict_UnloadSharedLib(libGL); 42 23 } trunk/DerelictGLFW/Makefile
r74 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) 8 DINC = -I$(SRC.DIR) -I..\DerelictUtil 9 9 10 10 GLFW.SRC.DIR = $(SRC.DIR)\derelict\glfw trunk/DerelictGLFW/derelict/glfw/glfw.d
r90 r91 42 42 module derelict.glfw.glfw; 43 43 44 private import std.loader; 45 46 private HXModule hglfw; 47 48 private void* getProc(char[] procname) 49 { 50 void* symbol = ExeModule_GetSymbol(hglfw, procname); 51 if (symbol is null) 52 throw new Exception("Failed to load glfw proc address " ~ procname); 53 return symbol; 54 } 55 56 private bit exeModuleInited = false; 44 private import derelict.util.loader; 45 46 private SharedLib libGLFW; 47 48 private void* getProc(char[] procName) 49 { 50 return Derelict_GetProc(libGLFW, procName); 51 } 57 52 58 53 public void DerelictGLFW_Load(char[] libName) 59 54 { 60 if( hglfw!== null)55 if(libGLFW !== null) 61 56 return; 62 57 63 // there's no guarantee this will be used in together with DerelictGL, 64 // could be used with another OpenGL binding, so initialize std.loader 65 // (even though it doesn't do anything). 66 if(ExeModule_Init() == -1) 67 throw new Exception("ExeModule initialization failed"); 68 69 exeModuleInited = true; 70 71 hglfw = ExeModule_Load(libName); 72 73 if(hglfw is null) 74 throw new Exception("Failed to load the GLFW shared library."); 75 58 libGLFW = Derelict_LoadSharedLib(libName); 76 59 load(); 77 60 } … … 87 70 public void DerelictGLFW_Unload() 88 71 { 89 if(hglfw) 90 ExeModule_Release(hglfw); 91 if(exeModuleInited) 92 { 93 ExeModule_Uninit(); 94 exeModuleInited = false; 95 } 72 Derelict_UnloadSharedLib(libGLFW); 96 73 } 97 74 trunk/DerelictSDL/Makefile
r66 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) 8 DINC = -I$(SRC.DIR) -I..\DerelictUtil 9 9 10 10 SDL.SRC.DIR = $(SRC.DIR)\derelict\sdl trunk/DerelictSDL/Makefile.linux
r69 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -r 8 DINC = -I$(SRC.DIR) 8 DINC = -I$(SRC.DIR) -I../DerelictUtil 9 9 10 10 SDL.SRC.DIR = $(SRC.DIR)/derelict/sdl trunk/DerelictSDL/derelict/sdl/sdl.d
r90 r91 23 23 */ 24 24 25 private import std.loader;25 private import derelict.util.loader; 26 26 27 27 import derelict.sdl.active; … … 81 81 // Loader 82 82 //============================================================================== 83 private HXModule hsdl; 84 private bit exeModuleInited = false; 85 86 private void* getProc(char[] procname) 87 { 88 void *symbol = ExeModule_GetSymbol(hsdl, procname); 89 if(symbol is null) 90 throw new Exception("Failed to load SDL proc address " ~ procname); 91 return symbol; 83 private SharedLib libSDL; 84 85 private void* getProc(char[] procName) 86 { 87 return Derelict_GetProc(libSDL, procName); 92 88 } 93 89 … … 307 303 public void DerelictSDL_Load(char[] libName) 308 304 { 309 if( hsdl!== null)305 if(libSDL !== null) 310 306 return; 311 307 312 if(ExeModule_Init() == -1) 313 throw new Exception("ExeModule initialization failed"); 314 315 exeModuleInited = true; 316 317 hsdl = ExeModule_Load(libName); 318 319 if(hsdl is null) 320 throw new Exception("Failed to load the SDL shared library"); 321 308 libSDL = Derelict_LoadSharedLib(libName); 322 309 load(); 323 310 } … … 333 320 public void DerelictSDL_Unload() 334 321 { 335 if(hsdl !== null) 336 ExeModule_Release(hsdl); 337 if(exeModuleInited) 338 { 339 ExeModule_Uninit(); 340 exeModuleInited = false; 341 } 322 Derelict_UnloadSharedLib(libSDL); 342 323 } 343 324 trunk/DerelictSDLImage/Makefile
r66 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) , -I..\DerelictSDL8 DINC = -I$(SRC.DIR) -I..\DerelictSDL -I..\DerelictUtil 9 9 10 10 SDLIMG.SRC.DIR = $(SRC.DIR)\derelict\sdl trunk/DerelictSDLImage/Makefile.linux
r66 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -r 8 DINC = -I$(SRC.DIR), -I../DerelictSDL 8 DINC = -I$(SRC.DIR), -I../DerelictSDL, -I../DerelictUtil 9 9 10 10 SDLIMG.SRC.DIR = $(SRC.DIR)/derelict/sdl trunk/DerelictSDLImage/derelict/sdl/image.d
r90 r91 24 24 25 25 26 private import derelict.sdl.sdl; 27 private import std.loader; 26 private 27 { 28 import derelict.sdl.sdl; 29 import derelict.util.loader; 30 } 28 31 29 32 //============================================================================== … … 81 84 // Loader 82 85 //============================================================================== 83 private HXModule hsdlImg;86 private SharedLib libSDLImage; 84 87 85 88 86 private void* getProc(char[] proc name)89 private void* getProc(char[] procName) 87 90 { 88 void *symbol = ExeModule_GetSymbol(hsdlImg, procname); 89 if(symbol is null) 90 throw new Exception("Failed to load SDLImage proc address " ~ procname); 91 return symbol; 91 return Derelict_GetProc(libSDLImage, procName); 92 92 } 93 93 … … 123 123 public void DerelictSDLImage_Load(char[] libName) 124 124 { 125 if( hsdlImg!== null)125 if(libSDLImage !== null) 126 126 return; 127 127 128 hsdlImg = ExeModule_Load(libName); 129 130 if(!hsdlImg) 131 throw new Exception("Failed to load the SDL_image shared library."); 132 128 libSDLImage = Derelict_LoadSharedLib(libName); 133 129 load(); 134 130 } … … 144 140 public void DerelictSDLImage_Unload() 145 141 { 146 if(hsdlImg !== null) 147 ExeModule_Release(hsdlImg); 142 Derelict_UnloadSharedLib(libSDLImage); 148 143 } 149 144 trunk/DerelictSDLMixer/Makefile
r70 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) , -I..\DerelictSDL8 DINC = -I$(SRC.DIR) -I..\DerelictSDL -I..\DerelictUtil 9 9 10 10 SDLMIX.SRC.DIR = $(SRC.DIR)\derelict\sdl trunk/DerelictSDLMixer/Makefile.linux
r70 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -r 8 DINC = -I$(SRC.DIR) , -I../DerelictSDL8 DINC = -I$(SRC.DIR) -I../DerelictSDL -I../DerelictUtil 9 9 10 10 SDLMIX.SRC.DIR = $(SRC.DIR)/derelict/sdl trunk/DerelictSDLMixer/derelict/sdl/mixer.d
r90 r91 23 23 */ 24 24 25 private import derelict.sdl.types; 26 private import derelict.sdl.rwops; 27 private import derelict.sdl.audio; 28 private import derelict.sdl.byteorder; 29 private import derelict.sdl.sdlversion; 30 private import derelict.sdl.error; 31 private import std.loader; 25 private 26 { 27 import derelict.sdl.types; 28 import derelict.sdl.rwops; 29 import derelict.sdl.audio; 30 import derelict.sdl.byteorder; 31 import derelict.sdl.sdlversion; 32 import derelict.sdl.error; 33 import derelict.util.loader; 34 } 32 35 33 36 //============================================================================== … … 247 250 // Loader 248 251 //============================================================================== 249 private HXModule hsdlMixer; 250 251 252 private void* getProc(char[] procname) 253 { 254 void *symbol = ExeModule_GetSymbol(hsdlMixer, procname); 255 if (symbol is null) 256 throw new Exception("Failed to load SDLMixer proc address " ~ procname); 257 return symbol; 252 private SharedLib libSDLMixer; 253 254 255 private void* getProc(char[] procName) 256 { 257 return Derelict_GetProc(libSDLMixer, procName); 258 258 } 259 259 … … 325 325 public void DerelictSDLMixer_Load(char[] libName) 326 326 { 327 if ( hsdlMixer !== null)327 if (libSDLMixer !== null) 328 328 return; 329 329 330 hsdlMixer = ExeModule_Load(libName); 331 332 if(hsdlMixer is null) 333 throw new Exception("Failed to load the SDL_mixer shared library."); 334 330 libSDLMixer = Derelict_LoadSharedLib(libName); 335 331 load(); 336 332 } … … 346 342 public void DerelictSDLMixer_Unload() 347 343 { 348 if(hsdlMixer !== null) 349 ExeModule_Release(hsdlMixer); 344 Derelict_UnloadSharedLib(libSDLMixer); 350 345 } 351 346 trunk/DerelictSDLNet/Makefile
r72 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) , -I..\DerelictSDL8 DINC = -I$(SRC.DIR) -I..\DerelictSDL -I..\DerelictUtil 9 9 10 10 SDLNET.SRC.DIR = $(SRC.DIR)\derelict\sdl trunk/DerelictSDLNet/Makefile.linux
r72 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -r 8 DINC = -I$(SRC.DIR) , -I../DerelictSDL8 DINC = -I$(SRC.DIR) -I../DerelictSDL -I..\DerelictUtil 9 9 10 10 SDLNET.SRC.DIR = $(SRC.DIR)/derelict/sdl trunk/DerelictSDLNet/derelict/sdl/net.d
r90 r91 23 23 */ 24 24 25 private import derelict.sdl.sdl; 26 private import std.loader; 25 private 26 { 27 import derelict.sdl.sdl; 28 import derelict.util.loader; 29 } 27 30 28 31 //============================================================================== … … 209 212 // LOADER 210 213 //============================================================================== 211 private HXModule hsdlNet; 212 213 private void* getProc(char[] procname) 214 { 215 void *symbol = ExeModule_GetSymbol(hsdlNet, procname); 216 if(symbol is null) 217 throw new Exception("Failed to load SDLNet proc address " ~ procname); 218 return symbol; 214 private SharedLib libSDLNet; 215 216 private void* getProc(char[] procName) 217 { 218 return Derelict_GetProc(libSDLNet, procName); 219 219 } 220 220 … … 254 254 public void DerelictSDLNet_Load(char[] libName) 255 255 { 256 if( hsdlNet !== null)256 if(libSDLNet !== null) 257 257 return; 258 258 259 hsdlNet = ExeModule_Load(libName); 260 261 if(hsdlNet is null) 262 throw new Exception("Failed to load the SDL_net shared library."); 263 259 libSDLNet = Derelict_LoadSharedLib(libName); 264 260 load(); 265 261 } … … 275 271 public void DerelictSDLNet_Unload() 276 272 { 277 if(hsdlNet !== null) 278 ExeModule_Release(hsdlNet); 273 Derelict_UnloadSharedLib(libSDLNet); 279 274 } 280 275 trunk/DerelictSDLttf/Makefile
r68 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -c -n 8 DINC = -I$(SRC.DIR) , -I..\DerelictSDL8 DINC = -I$(SRC.DIR) -I..\DerelictSDL -I..\DerelictUtil 9 9 10 10 SDLTTF.SRC.DIR = $(SRC.DIR)\derelict\sdl trunk/DerelictSDLttf/Makefile.linux
r68 r91 6 6 DFLAGS = -v 7 7 LIBFLAGS = -r 8 DINC = -I$(SRC.DIR), -I../DerelictSDL 8 DINC = -I$(SRC.DIR), -I../DerelictSDL -I../DerelictUtil 9 9 10 10 SDLTTF.SRC.DIR = $(SRC.DIR)/derelict/sdl trunk/DerelictSDLttf/derelict/sdl/ttf.d
r90 r91 29 29 30 30 31 private import derelict.sdl.sdl; 32 private import std.loader; 31 private 32 { 33 import derelict.sdl.sdl; 34 import derelict.util.loader; 35 } 33 36 34 37 … … 163 166 // Loader 164 167 //============================================================================== 165 private HXModule hsdlttf; 166 167 168 private void* getProc(char[] procname) 169 { 170 void *symbol = ExeModule_GetSymbol(hsdlttf, procname); 171 if (symbol is null) 172 throw new Exception("Failed to load SDLMixer proc address " ~ procname); 173 return symbol; 168 private SharedLib libSDLttf; 169 170 171 private void* getProc(char[] procName) 172 { 173 return Derelict_GetProc(libSDLttf, procName); 174 174 } 175 175 … … 216 216 public void DerelictSDLttf_Load(char[] libName) 217 217 { 218 if ( hsdlttf !== null)218 if (libSDLttf !== null) 219 219 return; 220 220 221 hsdlttf = ExeModule_Load(libName); 222 223 if(hsdlttf is null) 224 throw new Exception("Failed to load the SDL_ttf shared library."); 225 221 libSDLttf = Derelict_LoadSharedLib(libName); 226 222 load(); 227 223 } … … 237 233 public void DerelictSDLttf_Unload() 238 234 { 239 if(hsdlttf !== null) 240 ExeModule_Release(hsdlttf); 235 Derelict_UnloadSharedLib(libSDLttf); 241 236 } 242 237
