1 | /* |
---|
2 | SDL - Simple DirectMedia Layer |
---|
3 | Copyright (C) 1997-2012 Sam Lantinga |
---|
4 | |
---|
5 | This library is free software; you can redistribute it and/or |
---|
6 | modify it under the terms of the GNU Lesser General Public |
---|
7 | License as published by the Free Software Foundation; either |
---|
8 | version 2.1 of the License, or (at your option) any later version. |
---|
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 |
---|
13 | Lesser General Public License for more details. |
---|
14 | |
---|
15 | You should have received a copy of the GNU Lesser General Public |
---|
16 | License along with this library; if not, write to the Free Software |
---|
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
18 | |
---|
19 | Sam Lantinga |
---|
20 | slouken@libsdl.org |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _SDL_main_h |
---|
24 | #define _SDL_main_h |
---|
25 | |
---|
26 | #include "SDL_stdinc.h" |
---|
27 | |
---|
28 | /** @file SDL_main.h |
---|
29 | * Redefine main() on Win32 and MacOS so that it is called by winmain.c |
---|
30 | */ |
---|
31 | |
---|
32 | #if defined(__WIN32__) || \ |
---|
33 | (defined(__MWERKS__) && !defined(__BEOS__)) || \ |
---|
34 | defined(__MACOS__) || defined(__MACOSX__) || \ |
---|
35 | defined(__SYMBIAN32__) || defined(QWS) |
---|
36 | |
---|
37 | #ifdef __cplusplus |
---|
38 | #define C_LINKAGE "C" |
---|
39 | #else |
---|
40 | #define C_LINKAGE |
---|
41 | #endif /* __cplusplus */ |
---|
42 | |
---|
43 | /** The application's main() function must be called with C linkage, |
---|
44 | * and should be declared like this: |
---|
45 | * @code |
---|
46 | * #ifdef __cplusplus |
---|
47 | * extern "C" |
---|
48 | * #endif |
---|
49 | * int main(int argc, char *argv[]) |
---|
50 | * { |
---|
51 | * } |
---|
52 | * @endcode |
---|
53 | */ |
---|
54 | #define main SDL_main |
---|
55 | |
---|
56 | /** The prototype for the application's main() function */ |
---|
57 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); |
---|
58 | |
---|
59 | |
---|
60 | /** @name From the SDL library code -- needed for registering the app on Win32 */ |
---|
61 | /*@{*/ |
---|
62 | #ifdef __WIN32__ |
---|
63 | |
---|
64 | #include "begin_code.h" |
---|
65 | #ifdef __cplusplus |
---|
66 | extern "C" { |
---|
67 | #endif |
---|
68 | |
---|
69 | /** This should be called from your WinMain() function, if any */ |
---|
70 | extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); |
---|
71 | /** This can also be called, but is no longer necessary */ |
---|
72 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); |
---|
73 | /** This can also be called, but is no longer necessary (SDL_Quit calls it) */ |
---|
74 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); |
---|
75 | #ifdef __cplusplus |
---|
76 | } |
---|
77 | #endif |
---|
78 | #include "close_code.h" |
---|
79 | #endif |
---|
80 | /*@}*/ |
---|
81 | |
---|
82 | /** @name From the SDL library code -- needed for registering QuickDraw on MacOS */ |
---|
83 | /*@{*/ |
---|
84 | #if defined(__MACOS__) |
---|
85 | |
---|
86 | #include "begin_code.h" |
---|
87 | #ifdef __cplusplus |
---|
88 | extern "C" { |
---|
89 | #endif |
---|
90 | |
---|
91 | /** Forward declaration so we don't need to include QuickDraw.h */ |
---|
92 | struct QDGlobals; |
---|
93 | |
---|
94 | /** This should be called from your main() function, if any */ |
---|
95 | extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); |
---|
96 | |
---|
97 | #ifdef __cplusplus |
---|
98 | } |
---|
99 | #endif |
---|
100 | #include "close_code.h" |
---|
101 | #endif |
---|
102 | /*@}*/ |
---|
103 | |
---|
104 | #endif /* Need to redefine main()? */ |
---|
105 | |
---|
106 | #endif /* _SDL_main_h */ |
---|