| 1 | /* |
| 2 | SDL - Simple DirectMedia Layer |
| 3 | Copyright (C) 1997-2010 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 | /** |
| 29 | * \file SDL_main.h |
| 30 | * |
| 31 | * Redefine main() on some platforms so that it is called by SDL. |
| 32 | */ |
| 33 | |
| 34 | #if defined(__WIN32__) || \ |
| 35 | (defined(__MWERKS__) && !defined(__BEOS__)) || \ |
| 36 | defined(__SYMBIAN32__) || defined(__IPHONEOS__) |
| 37 | |
| 38 | #ifdef __cplusplus |
| 39 | #define C_LINKAGE "C" |
| 40 | #else |
| 41 | #define C_LINKAGE |
| 42 | #endif /* __cplusplus */ |
| 43 | |
| 44 | /** |
| 45 | * \file SDL_main.h |
| 46 | * |
| 47 | * The application's main() function must be called with C linkage, |
| 48 | * and should be declared like this: |
| 49 | * \code |
| 50 | * #ifdef __cplusplus |
| 51 | * extern "C" |
| 52 | * #endif |
| 53 | * int main(int argc, char *argv[]) |
| 54 | * { |
| 55 | * } |
| 56 | * \endcode |
| 57 | */ |
| 58 | |
| 59 | #define main SDL_main |
| 60 | |
| 61 | /** |
| 62 | * The prototype for the application's main() function |
| 63 | */ |
| 64 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); |
| 65 | |
| 66 | |
| 67 | /* From the SDL library code -- needed for registering the app on Win32 */ |
| 68 | #ifdef __WIN32__ |
| 69 | |
| 70 | #include "begin_code.h" |
| 71 | #ifdef __cplusplus |
| 72 | /* *INDENT-OFF* */ |
| 73 | extern "C" { |
| 74 | /* *INDENT-ON* */ |
| 75 | #endif |
| 76 | |
| 77 | /** |
| 78 | * This can be called to set the application class at startup |
| 79 | */ |
| 80 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, |
| 81 | void *hInst); |
| 82 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); |
| 83 | |
| 84 | #ifdef __cplusplus |
| 85 | /* *INDENT-OFF* */ |
| 86 | } |
| 87 | /* *INDENT-ON* */ |
| 88 | #endif |
| 89 | #include "close_code.h" |
| 90 | #endif |
| 91 | |
| 92 | #endif /* Need to redefine main()? */ |
| 93 | |
| 94 | #endif /* _SDL_main_h */ |
| 95 | |
| 96 | /* vi: set ts=4 sw=4 expandtab: */ |