2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
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.
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.
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
23 /* This file sets things up for C dynamic library function definitions,
24 static inlined functions, and structures aligned at 4-byte alignment.
25 If you don't like ugly C preprocessor code, don't look at this file. :)
28 /* This shouldn't be nested -- included it around code only. */
30 #error Nested inclusion of begin_code.h
34 /* Make sure the correct platform symbols are defined */
35 #if !defined(WIN32) && defined(_WIN32)
39 /* Some compilers use a special export keyword */
42 # if defined(__GNUC__)
43 # define DECLSPEC __declspec(dllexport)
45 # define DECLSPEC __declspec(export)
51 # define DECLSPEC __declspec(dllexport)
53 # define DECLSPEC __declspec(dllimport)
56 # define DECLSPEC __declspec(dllexport)
64 /* By default SDL uses the C calling convention */
67 #define SDLCALL __cdecl
73 /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
77 #endif /* __SYMBIAN32__ */
79 /* Force structure packing at 4 byte alignment.
80 This is necessary if the header is included in code which has structure
81 packing set to an alternate value, say for loading structures from disk.
82 The packing is reset to the previous value in close_code.h
84 #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
86 #pragma warning(disable: 4103)
92 #elif (defined(__MWERKS__) && defined(macintosh))
93 #pragma options align=mac68k4byte
94 #pragma enumsalwaysint on
95 #endif /* Compiler needs structure packing set */
97 /* Set up compiler-specific options for inlining functions */
98 #ifndef SDL_INLINE_OKAY
100 #define SDL_INLINE_OKAY
102 /* Add any special compiler-specific cases here */
103 #if defined(_MSC_VER) || defined(__BORLANDC__) || \
104 defined(__DMC__) || defined(__SC__) || \
105 defined(__WATCOMC__) || defined(__LCC__)
107 #define __inline__ __inline
109 #define SDL_INLINE_OKAY
111 #if !defined(__MRC__) && !defined(_SGI_SOURCE)
112 #define __inline__ inline
113 #define SDL_INLINE_OKAY
114 #endif /* Not a funky compiler */
115 #endif /* Visual C++ */
117 #endif /* SDL_INLINE_OKAY */
119 /* If inlining isn't supported, remove "__inline__", turning static
120 inlined functions into static functions (resulting in code bloat
121 in all files which include the offending header files)
123 #ifndef SDL_INLINE_OKAY
127 /* Apparently this is needed by several Windows compilers */
128 #if !defined(__MACH__)
133 #define NULL ((void *)0)
136 #endif /* ! MacOS X - breaks precompiled headers */