author | Sam Lantinga <slouken@libsdl.org> |
Sun, 21 May 2006 16:47:41 +0000 | |
changeset 1854 | 2280e314a978 |
parent 1487 | dc6b59e925a2 |
child 1662 | 782fd950bd46 |
child 1895 | c121d94672cb |
child 3975 | e85e65aec22f |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
SDL - Simple DirectMedia Layer |
|
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
3 |
Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
|
5 |
This library is free software; you can redistribute it and/or |
|
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
6 |
modify it under the terms of the GNU Lesser General Public |
0 | 7 |
License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
8 |
version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
|
10 |
This library is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
13 |
Lesser General Public License for more details. |
0 | 14 |
|
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
15 |
You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 |
License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
17 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
|
19 |
Sam Lantinga |
|
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
36
diff
changeset
|
20 |
slouken@libsdl.org |
0 | 21 |
*/ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 |
#include "SDL_config.h" |
0 | 23 |
|
24 |
/* Initialization code for SDL */ |
|
25 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
26 |
#include "SDL.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
27 |
#include "SDL_fatal.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
28 |
#if !SDL_VIDEO_DISABLED |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
29 |
#include "video/SDL_leaks.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 |
#endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 |
|
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
32 |
#if SDL_THREAD_PTH |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
543
diff
changeset
|
33 |
#include <pth.h> |
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
543
diff
changeset
|
34 |
#endif |
0 | 35 |
|
36 |
/* Initialization/Cleanup routines */ |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
37 |
#if !SDL_JOYSTICK_DISABLED |
0 | 38 |
extern int SDL_JoystickInit(void); |
39 |
extern void SDL_JoystickQuit(void); |
|
40 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
41 |
#if !SDL_CDROM_DISABLED |
0 | 42 |
extern int SDL_CDROMInit(void); |
43 |
extern void SDL_CDROMQuit(void); |
|
44 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
45 |
#if !SDL_TIMERS_DISABLED |
0 | 46 |
extern void SDL_StartTicks(void); |
47 |
extern int SDL_TimerInit(void); |
|
48 |
extern void SDL_TimerQuit(void); |
|
49 |
#endif |
|
50 |
||
51 |
/* The current SDL version */ |
|
52 |
static SDL_version version = |
|
53 |
{ SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL }; |
|
54 |
||
55 |
/* The initialized subsystems */ |
|
56 |
static Uint32 SDL_initialized = 0; |
|
57 |
static Uint32 ticks_started = 0; |
|
58 |
||
59 |
#ifdef CHECK_LEAKS |
|
60 |
int surfaces_allocated = 0; |
|
61 |
#endif |
|
62 |
||
63 |
int SDL_InitSubSystem(Uint32 flags) |
|
64 |
{ |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
65 |
#if !SDL_VIDEO_DISABLED |
0 | 66 |
/* Initialize the video/event subsystem */ |
67 |
if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) { |
|
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
68 |
if ( SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"), |
0 | 69 |
(flags&SDL_INIT_EVENTTHREAD)) < 0 ) { |
70 |
return(-1); |
|
71 |
} |
|
72 |
SDL_initialized |= SDL_INIT_VIDEO; |
|
73 |
} |
|
74 |
#else |
|
75 |
if ( flags & SDL_INIT_VIDEO ) { |
|
76 |
SDL_SetError("SDL not built with video support"); |
|
77 |
return(-1); |
|
78 |
} |
|
79 |
#endif |
|
80 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
81 |
#if !SDL_AUDIO_DISABLED |
0 | 82 |
/* Initialize the audio subsystem */ |
83 |
if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) { |
|
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
84 |
if ( SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0 ) { |
0 | 85 |
return(-1); |
86 |
} |
|
87 |
SDL_initialized |= SDL_INIT_AUDIO; |
|
88 |
} |
|
89 |
#else |
|
90 |
if ( flags & SDL_INIT_AUDIO ) { |
|
91 |
SDL_SetError("SDL not built with audio support"); |
|
92 |
return(-1); |
|
93 |
} |
|
94 |
#endif |
|
95 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
96 |
#if !SDL_TIMERS_DISABLED |
0 | 97 |
/* Initialize the timer subsystem */ |
98 |
if ( ! ticks_started ) { |
|
99 |
SDL_StartTicks(); |
|
100 |
ticks_started = 1; |
|
101 |
} |
|
102 |
if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) { |
|
103 |
if ( SDL_TimerInit() < 0 ) { |
|
104 |
return(-1); |
|
105 |
} |
|
106 |
SDL_initialized |= SDL_INIT_TIMER; |
|
107 |
} |
|
108 |
#else |
|
109 |
if ( flags & SDL_INIT_TIMER ) { |
|
110 |
SDL_SetError("SDL not built with timer support"); |
|
111 |
return(-1); |
|
112 |
} |
|
113 |
#endif |
|
114 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
115 |
#if !SDL_JOYSTICK_DISABLED |
0 | 116 |
/* Initialize the joystick subsystem */ |
117 |
if ( (flags & SDL_INIT_JOYSTICK) && |
|
118 |
!(SDL_initialized & SDL_INIT_JOYSTICK) ) { |
|
119 |
if ( SDL_JoystickInit() < 0 ) { |
|
120 |
return(-1); |
|
121 |
} |
|
122 |
SDL_initialized |= SDL_INIT_JOYSTICK; |
|
123 |
} |
|
124 |
#else |
|
125 |
if ( flags & SDL_INIT_JOYSTICK ) { |
|
126 |
SDL_SetError("SDL not built with joystick support"); |
|
127 |
return(-1); |
|
128 |
} |
|
129 |
#endif |
|
130 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
131 |
#if !SDL_CDROM_DISABLED |
0 | 132 |
/* Initialize the CD-ROM subsystem */ |
133 |
if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) { |
|
134 |
if ( SDL_CDROMInit() < 0 ) { |
|
135 |
return(-1); |
|
136 |
} |
|
137 |
SDL_initialized |= SDL_INIT_CDROM; |
|
138 |
} |
|
139 |
#else |
|
140 |
if ( flags & SDL_INIT_CDROM ) { |
|
141 |
SDL_SetError("SDL not built with cdrom support"); |
|
142 |
return(-1); |
|
143 |
} |
|
144 |
#endif |
|
145 |
return(0); |
|
146 |
} |
|
147 |
||
148 |
int SDL_Init(Uint32 flags) |
|
149 |
{ |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
150 |
#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH |
397 | 151 |
if (!pth_init()) { |
152 |
return -1; |
|
153 |
} |
|
154 |
#endif |
|
155 |
||
0 | 156 |
/* Clear the error message */ |
157 |
SDL_ClearError(); |
|
158 |
||
159 |
/* Initialize the desired subsystems */ |
|
160 |
if ( SDL_InitSubSystem(flags) < 0 ) { |
|
161 |
return(-1); |
|
162 |
} |
|
163 |
||
164 |
/* Everything is initialized */ |
|
165 |
if ( !(flags & SDL_INIT_NOPARACHUTE) ) { |
|
166 |
SDL_InstallParachute(); |
|
167 |
} |
|
168 |
return(0); |
|
169 |
} |
|
170 |
||
171 |
void SDL_QuitSubSystem(Uint32 flags) |
|
172 |
{ |
|
173 |
/* Shut down requested initialized subsystems */ |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
174 |
#if !SDL_CDROM_DISABLED |
0 | 175 |
if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) { |
176 |
SDL_CDROMQuit(); |
|
177 |
SDL_initialized &= ~SDL_INIT_CDROM; |
|
178 |
} |
|
179 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
180 |
#if !SDL_JOYSTICK_DISABLED |
0 | 181 |
if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) { |
182 |
SDL_JoystickQuit(); |
|
183 |
SDL_initialized &= ~SDL_INIT_JOYSTICK; |
|
184 |
} |
|
185 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
186 |
#if !SDL_TIMERS_DISABLED |
0 | 187 |
if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) { |
188 |
SDL_TimerQuit(); |
|
189 |
SDL_initialized &= ~SDL_INIT_TIMER; |
|
190 |
} |
|
191 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
192 |
#if !SDL_AUDIO_DISABLED |
0 | 193 |
if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) { |
194 |
SDL_AudioQuit(); |
|
195 |
SDL_initialized &= ~SDL_INIT_AUDIO; |
|
196 |
} |
|
197 |
#endif |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
198 |
#if !SDL_VIDEO_DISABLED |
0 | 199 |
if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) { |
200 |
SDL_VideoQuit(); |
|
201 |
SDL_initialized &= ~SDL_INIT_VIDEO; |
|
202 |
} |
|
203 |
#endif |
|
204 |
} |
|
205 |
||
206 |
Uint32 SDL_WasInit(Uint32 flags) |
|
207 |
{ |
|
208 |
if ( ! flags ) { |
|
209 |
flags = SDL_INIT_EVERYTHING; |
|
210 |
} |
|
211 |
return (SDL_initialized&flags); |
|
212 |
} |
|
213 |
||
214 |
void SDL_Quit(void) |
|
215 |
{ |
|
216 |
/* Quit all subsystems */ |
|
1190 | 217 |
#ifdef DEBUG_BUILD |
218 |
printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n"); fflush(stdout); |
|
219 |
#endif |
|
0 | 220 |
SDL_QuitSubSystem(SDL_INIT_EVERYTHING); |
221 |
||
222 |
#ifdef CHECK_LEAKS |
|
1190 | 223 |
#ifdef DEBUG_BUILD |
224 |
printf("[SDL_Quit] : CHECK_LEAKS\n"); fflush(stdout); |
|
225 |
#endif |
|
226 |
||
0 | 227 |
/* Print the number of surfaces not freed */ |
228 |
if ( surfaces_allocated != 0 ) { |
|
229 |
fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n", |
|
230 |
surfaces_allocated); |
|
231 |
} |
|
232 |
#endif |
|
1190 | 233 |
#ifdef DEBUG_BUILD |
234 |
printf("[SDL_Quit] : SDL_UninstallParachute()\n"); fflush(stdout); |
|
235 |
#endif |
|
0 | 236 |
|
237 |
/* Uninstall any parachute signal handlers */ |
|
238 |
SDL_UninstallParachute(); |
|
397 | 239 |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
240 |
#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH |
397 | 241 |
pth_kill(); |
242 |
#endif |
|
1190 | 243 |
#ifdef DEBUG_BUILD |
244 |
printf("[SDL_Quit] : Returning!\n"); fflush(stdout); |
|
245 |
#endif |
|
246 |
||
0 | 247 |
} |
248 |
||
249 |
/* Return the library version number */ |
|
250 |
const SDL_version * SDL_Linked_Version(void) |
|
251 |
{ |
|
252 |
return(&version); |
|
253 |
} |
|
254 |
||
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
255 |
#if defined(__OS2__) |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
256 |
/* Building for OS/2 */ |
1190 | 257 |
#ifdef __WATCOMC__ |
258 |
||
259 |
#define INCL_DOSERRORS |
|
260 |
#define INCL_DOSEXCEPTIONS |
|
261 |
#include <os2.h> |
|
262 |
||
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
263 |
/* Exception handler to prevent the Audio thread hanging, making a zombie process! */ |
1190 | 264 |
ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, |
265 |
PEXCEPTIONREGISTRATIONRECORD pERegRec, |
|
266 |
PCONTEXTRECORD pCtxRec, |
|
267 |
PVOID p) |
|
268 |
{ |
|
269 |
if (pERepRec->fHandlerFlags & EH_EXIT_UNWIND) |
|
270 |
return XCPT_CONTINUE_SEARCH; |
|
271 |
if (pERepRec->fHandlerFlags & EH_UNWINDING) |
|
272 |
return XCPT_CONTINUE_SEARCH; |
|
273 |
if (pERepRec->fHandlerFlags & EH_NESTED_CALL) |
|
274 |
return XCPT_CONTINUE_SEARCH; |
|
275 |
||
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
276 |
/* Do cleanup at every fatal exception! */ |
1190 | 277 |
if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) && |
278 |
(pERepRec->ExceptionNum != XCPT_BREAKPOINT) && |
|
279 |
(pERepRec->ExceptionNum != XCPT_SINGLE_STEP) |
|
280 |
) |
|
281 |
{ |
|
282 |
if (SDL_initialized & SDL_INIT_AUDIO) |
|
283 |
{ |
|
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
284 |
/* This removes the zombie audio thread in case of emergency. */ |
1190 | 285 |
#ifdef DEBUG_BUILD |
286 |
printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n"); |
|
287 |
#endif |
|
288 |
SDL_CloseAudio(); |
|
289 |
} |
|
290 |
} |
|
291 |
return (XCPT_CONTINUE_SEARCH); |
|
292 |
} |
|
293 |
||
294 |
||
295 |
EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler}; |
|
296 |
||
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
297 |
/* The main DLL entry for DLL Initialization and Uninitialization: */ |
1190 | 298 |
unsigned _System LibMain(unsigned hmod, unsigned termination) |
299 |
{ |
|
300 |
if (termination) |
|
301 |
{ |
|
302 |
#ifdef DEBUG_BUILD |
|
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
303 |
/* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */ |
1190 | 304 |
#endif |
305 |
DosUnsetExceptionHandler(&SDL_Main_xcpthand); |
|
306 |
return 1; |
|
307 |
} else |
|
308 |
{ |
|
309 |
#ifdef DEBUG_BUILD |
|
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
310 |
/* Make stdout and stderr unbuffered! */ |
1190 | 311 |
setbuf(stdout, NULL); |
312 |
setbuf(stderr, NULL); |
|
313 |
#endif |
|
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
314 |
/* Fire up exception handler */ |
1190 | 315 |
#ifdef DEBUG_BUILD |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
316 |
/* printf("[SDL DLL Initialization] : Setting exception handler\n"); */ |
1190 | 317 |
#endif |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1465
diff
changeset
|
318 |
/* Set exception handler */ |
1190 | 319 |
DosSetExceptionHandler(&SDL_Main_xcpthand); |
320 |
||
321 |
return 1; |
|
322 |
} |
|
323 |
} |
|
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
324 |
#endif /* __WATCOMC__ */ |
1190 | 325 |
|
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
326 |
#elif defined(__WIN32__) |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
327 |
|
1465
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
328 |
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) |
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
329 |
/* Need to include DllMain() on Watcom C for some reason.. */ |
1433
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
330 |
#define WIN32_LEAN_AND_MEAN |
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
331 |
#include <windows.h> |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
332 |
|
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
333 |
BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule, |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
334 |
DWORD ul_reason_for_call, |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
335 |
LPVOID lpReserved ) |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
336 |
{ |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
337 |
switch (ul_reason_for_call) { |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
338 |
case DLL_PROCESS_ATTACH: |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
339 |
case DLL_THREAD_ATTACH: |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
340 |
case DLL_THREAD_DETACH: |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
341 |
case DLL_PROCESS_DETACH: |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
342 |
break; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
343 |
} |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
344 |
return TRUE; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
345 |
} |
1465
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
346 |
#endif /* building DLL with Watcom C */ |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
347 |
|
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
348 |
#endif /* OS/2 elif __WIN32__ */ |