include/SDL_main.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 11 Apr 2002 14:35:16 +0000
changeset 337 9154ec9ca3d2
parent 297 f6ffac90895c
child 371 db0cc6034336
permissions -rw-r--r--
Explicitly specify the SDL API calling convention (C by default)
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Library General Public
     7     License as published by the Free Software Foundation; either
     8     version 2 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     Library General Public License for more details.
    14 
    15     You should have received a copy of the GNU Library General Public
    16     License along with this library; if not, write to the Free
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 #ifdef SAVE_RCSID
    24 static char rcsid =
    25  "@(#) $Id$";
    26 #endif
    27 
    28 #ifndef _SDL_main_h
    29 #define _SDL_main_h
    30 
    31 /* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
    32 
    33 #if defined(WIN32) || (defined(__MWERKS__) && !defined(__BEOS__)) || \
    34     defined(macintosh) || defined(__APPLE__) || defined(__SYMBIAN32__)
    35 
    36 #ifdef __cplusplus
    37 #define C_LINKAGE	"C"
    38 #else
    39 #define C_LINKAGE
    40 #endif /* __cplusplus */
    41 
    42 /* The application's main() function must be called with C linkage,
    43    and should be declared like this:
    44 #ifdef __cplusplus
    45 extern "C"
    46 #endif
    47 	int main(int argc, char *argv[])
    48 	{
    49 	}
    50  */
    51 #define main	SDL_main
    52 
    53 /* The prototype for the application's main() function */
    54 extern C_LINKAGE int SDL_main(int argc, char *argv[]);
    55 
    56 
    57 /* From the SDL library code -- needed for registering the app on Win32 */
    58 #if defined(WIN32)
    59 #include "SDL_types.h"
    60 #include "begin_code.h"
    61 
    62 #ifdef __cplusplus
    63 extern "C" {
    64 #endif
    65 
    66 /* This should be called from your WinMain() function, if any */
    67 extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
    68 /* This can also be called, but is no longer necessary */
    69 extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
    70 
    71 #ifdef __cplusplus
    72 }
    73 #endif
    74 #include "close_code.h"
    75 #endif
    76 
    77 /* From the SDL library code -- needed for registering QuickDraw on MacOS */
    78 #if defined(macintosh)
    79 #include "begin_code.h"
    80 
    81 #ifdef __cplusplus
    82 extern "C" {
    83 #endif
    84 
    85 /* Forward declaration so we don't need to include QuickDraw.h */
    86 struct QDGlobals;
    87 
    88 /* This should be called from your main() function, if any */
    89 extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
    90 
    91 #ifdef __cplusplus
    92 }
    93 #endif
    94 #include "close_code.h"
    95 #endif
    96 
    97 #endif /* Need to redefine main()? */
    98 
    99 #endif /* _SDL_main_h */