src/SDL.c
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
equal deleted inserted replaced
1329:bc67bbf87818 1330:450721ad5436
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /* Initialization code for SDL */
    23 /* Initialization code for SDL */
    24 
    24 
    25 #include <stdlib.h>		/* For getenv() */
       
    26 #ifdef ENABLE_PTH
    25 #ifdef ENABLE_PTH
    27 #include <pth.h>
    26 #include <pth.h>
    28 #endif
    27 #endif
    29 
    28 
    30 #include "SDL.h"
    29 #include "SDL.h"
    31 #include "SDL_endian.h"
    30 #include "SDL_endian.h"
    32 #include "SDL_fatal.h"
    31 #include "SDL_fatal.h"
       
    32 #include "SDL_stdlib.h"
    33 #ifndef DISABLE_VIDEO
    33 #ifndef DISABLE_VIDEO
    34 #include "SDL_leaks.h"
    34 #include "SDL_leaks.h"
    35 #endif
    35 #endif
    36 
    36 
    37 /* Initialization/Cleanup routines */
    37 /* Initialization/Cleanup routines */
   251 const SDL_version * SDL_Linked_Version(void)
   251 const SDL_version * SDL_Linked_Version(void)
   252 {
   252 {
   253 	return(&version);
   253 	return(&version);
   254 }
   254 }
   255 
   255 
   256 #ifndef __OS2__
   256 #if defined(__OS2__)
   257 #if defined(_WIN32_WCE) || (defined(__WATCOMC__) && defined(BUILD_DLL))
       
   258 /* Need to include DllMain() on Windows CE and Watcom C for some reason.. */
       
   259 #include <windows.h>
       
   260 
       
   261 BOOL APIENTRY DllMain( HANDLE hModule, 
       
   262                        DWORD  ul_reason_for_call, 
       
   263                        LPVOID lpReserved )
       
   264 {
       
   265 	switch (ul_reason_for_call) {
       
   266 		case DLL_PROCESS_ATTACH:
       
   267 		case DLL_THREAD_ATTACH:
       
   268 		case DLL_THREAD_DETACH:
       
   269 		case DLL_PROCESS_DETACH:
       
   270 			break;
       
   271 	}
       
   272 	return TRUE;
       
   273 }
       
   274 #endif /* _WIN32_WCE and building DLL with Watcom C */
       
   275 #else
       
   276 // Building for OS/2
   257 // Building for OS/2
   277 #ifdef __WATCOMC__
   258 #ifdef __WATCOMC__
   278 
   259 
   279 #define INCL_DOSERRORS
   260 #define INCL_DOSERRORS
   280 #define INCL_DOSEXCEPTIONS
   261 #define INCL_DOSEXCEPTIONS
   339     DosSetExceptionHandler(&SDL_Main_xcpthand);
   320     DosSetExceptionHandler(&SDL_Main_xcpthand);
   340 
   321 
   341     return 1;
   322     return 1;
   342   }
   323   }
   343 }
   324 }
   344 
   325 #endif /* __WATCOMC__ */
   345 #endif
   326 
   346 #endif
   327 #elif defined(_WIN32)
       
   328 
       
   329 #if !defined(HAVE_LIBC) || defined(_WIN32_WCE) || (defined(__WATCOMC__) && defined(BUILD_DLL))
       
   330 /* Need to include DllMain() on Windows CE and Watcom C for some reason.. */
       
   331 #include "SDL_windows.h"
       
   332 
       
   333 BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule, 
       
   334                        DWORD  ul_reason_for_call, 
       
   335                        LPVOID lpReserved )
       
   336 {
       
   337 	switch (ul_reason_for_call) {
       
   338 		case DLL_PROCESS_ATTACH:
       
   339 		case DLL_THREAD_ATTACH:
       
   340 		case DLL_THREAD_DETACH:
       
   341 		case DLL_PROCESS_DETACH:
       
   342 			break;
       
   343 	}
       
   344 	return TRUE;
       
   345 }
       
   346 #endif /* _WIN32_WCE and building DLL with Watcom C */
       
   347 
       
   348 #endif /* OS/2 elif _WIN32 */