SDL_main.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. SDL - Simple DirectMedia Layer
  3. Copyright (C) 1997-2010 Sam Lantinga
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Sam Lantinga
  16. [email protected]
  17. */
  18. #ifndef _SDL_main_h
  19. #define _SDL_main_h
  20. #include "SDL_stdinc.h"
  21. /**
  22. * \file SDL_main.h
  23. *
  24. * Redefine main() on some platforms so that it is called by SDL.
  25. */
  26. #if defined(__WIN32__) || \
  27. (defined(__MWERKS__) && !defined(__BEOS__)) || \
  28. defined(__SYMBIAN32__) || defined(__IPHONEOS__)
  29. #ifdef __cplusplus
  30. #define C_LINKAGE "C"
  31. #else
  32. #define C_LINKAGE
  33. #endif /* __cplusplus */
  34. /**
  35. * \file SDL_main.h
  36. *
  37. * The application's main() function must be called with C linkage,
  38. * and should be declared like this:
  39. * \code
  40. * #ifdef __cplusplus
  41. * extern "C"
  42. * #endif
  43. * int main(int argc, char *argv[])
  44. * {
  45. * }
  46. * \endcode
  47. */
  48. #define main SDL_main
  49. /**
  50. * The prototype for the application's main() function
  51. */
  52. extern C_LINKAGE int SDL_main(int argc, char *argv[]);
  53. /* From the SDL library code -- needed for registering the app on Win32 */
  54. #ifdef __WIN32__
  55. #include "begin_code.h"
  56. #ifdef __cplusplus
  57. /* *INDENT-OFF* */
  58. extern "C" {
  59. /* *INDENT-ON* */
  60. #endif
  61. /**
  62. * This can be called to set the application class at startup
  63. */
  64. extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
  65. void *hInst);
  66. extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
  67. #ifdef __cplusplus
  68. /* *INDENT-OFF* */
  69. }
  70. /* *INDENT-ON* */
  71. #endif
  72. #include "close_code.h"
  73. #endif
  74. #endif /* Need to redefine main()? */
  75. #endif /* _SDL_main_h */
  76. /* vi: set ts=4 sw=4 expandtab: */