misc/winutils/include/begin_code.h
changeset 10017 de822cd3df3a
parent 7809 7d4fb2f35f4f
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
    18 
    18 
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /** 
    23 /**
    24  *  @file begin_code.h
    24  *  @file begin_code.h
    25  *  This file sets things up for C dynamic library function definitions,
    25  *  This file sets things up for C dynamic library function definitions,
    26  *  static inlined functions, and structures aligned at 4-byte alignment.
    26  *  static inlined functions, and structures aligned at 4-byte alignment.
    27  *  If you don't like ugly C preprocessor code, don't look at this file. :)
    27  *  If you don't like ugly C preprocessor code, don't look at this file. :)
    28  */
    28  */
    29 
    29 
    30 /** 
    30 /**
    31  *  @file begin_code.h
    31  *  @file begin_code.h
    32  *  This shouldn't be nested -- included it around code only.
    32  *  This shouldn't be nested -- included it around code only.
    33  */
    33  */
    34 #ifdef _begin_code_h
    34 #ifdef _begin_code_h
    35 #error Nested inclusion of begin_code.h
    35 #error Nested inclusion of begin_code.h
    36 #endif
    36 #endif
    37 #define _begin_code_h
    37 #define _begin_code_h
    38 
    38 
    39 /** 
    39 /**
    40  *  @def DECLSPEC
    40  *  @def DECLSPEC
    41  *  Some compilers use a special export keyword
    41  *  Some compilers use a special export keyword
    42  */
    42  */
    43 #ifndef DECLSPEC
    43 #ifndef DECLSPEC
    44 # if defined(__BEOS__) || defined(__HAIKU__)
    44 # if defined(__BEOS__) || defined(__HAIKU__)
    45 #  if defined(__GNUC__)
    45 #  if defined(__GNUC__)
    46 #   define DECLSPEC
    46 #   define DECLSPEC
    47 #  else
    47 #  else
    48 #   define DECLSPEC	__declspec(export)
    48 #   define DECLSPEC __declspec(export)
    49 #  endif
    49 #  endif
    50 # elif defined(__WIN32__)
    50 # elif defined(__WIN32__)
    51 #  ifdef __BORLANDC__
    51 #  ifdef __BORLANDC__
    52 #   ifdef BUILD_SDL
    52 #   ifdef BUILD_SDL
    53 #    define DECLSPEC 
    53 #    define DECLSPEC
    54 #   else
    54 #   else
    55 #    define DECLSPEC	__declspec(dllimport)
    55 #    define DECLSPEC    __declspec(dllimport)
    56 #   endif
    56 #   endif
    57 #  else
    57 #  else
    58 #   define DECLSPEC	__declspec(dllexport)
    58 #   define DECLSPEC __declspec(dllexport)
    59 #  endif
    59 #  endif
    60 # elif defined(__OS2__)
    60 # elif defined(__OS2__)
    61 #  ifdef __WATCOMC__
    61 #  ifdef __WATCOMC__
    62 #   ifdef BUILD_SDL
    62 #   ifdef BUILD_SDL
    63 #    define DECLSPEC	__declspec(dllexport)
    63 #    define DECLSPEC    __declspec(dllexport)
    64 #   else
    64 #   else
    65 #    define DECLSPEC
    65 #    define DECLSPEC
    66 #   endif
    66 #   endif
    67 #  elif defined (__GNUC__) && __GNUC__ < 4
    67 #  elif defined (__GNUC__) && __GNUC__ < 4
    68 #   /* Added support for GCC-EMX <v4.x */
    68 #   /* Added support for GCC-EMX <v4.x */
    76 #  else
    76 #  else
    77 #   define DECLSPEC
    77 #   define DECLSPEC
    78 #  endif
    78 #  endif
    79 # else
    79 # else
    80 #  if defined(__GNUC__) && __GNUC__ >= 4
    80 #  if defined(__GNUC__) && __GNUC__ >= 4
    81 #   define DECLSPEC	__attribute__ ((visibility("default")))
    81 #   define DECLSPEC __attribute__ ((visibility("default")))
    82 #  else
    82 #  else
    83 #   define DECLSPEC
    83 #   define DECLSPEC
    84 #  endif
    84 #  endif
    85 # endif
    85 # endif
    86 #endif
    86 #endif
    87 
    87 
    88 /** 
    88 /**
    89  *  @def SDLCALL
    89  *  @def SDLCALL
    90  *  By default SDL uses the C calling convention
    90  *  By default SDL uses the C calling convention
    91  */
    91  */
    92 #ifndef SDLCALL
    92 #ifndef SDLCALL
    93 # if defined(__WIN32__) && !defined(__GNUC__)
    93 # if defined(__WIN32__) && !defined(__GNUC__)
   106 # else
   106 # else
   107 #  define SDLCALL
   107 #  define SDLCALL
   108 # endif
   108 # endif
   109 #endif /* SDLCALL */
   109 #endif /* SDLCALL */
   110 
   110 
   111 #ifdef __SYMBIAN32__ 
   111 #ifdef __SYMBIAN32__
   112 #ifndef EKA2 
   112 #ifndef EKA2
   113 #undef DECLSPEC
   113 #undef DECLSPEC
   114 #define DECLSPEC
   114 #define DECLSPEC
   115 #elif !defined(__WINS__)
   115 #elif !defined(__WINS__)
   116 #undef DECLSPEC
   116 #undef DECLSPEC
   117 #define DECLSPEC __declspec(dllexport)
   117 #define DECLSPEC __declspec(dllexport)
   121 /**
   121 /**
   122  *  @file begin_code.h
   122  *  @file begin_code.h
   123  *  Force structure packing at 4 byte alignment.
   123  *  Force structure packing at 4 byte alignment.
   124  *  This is necessary if the header is included in code which has structure
   124  *  This is necessary if the header is included in code which has structure
   125  *  packing set to an alternate value, say for loading structures from disk.
   125  *  packing set to an alternate value, say for loading structures from disk.
   126  *  The packing is reset to the previous value in close_code.h 
   126  *  The packing is reset to the previous value in close_code.h
   127  */
   127  */
   128 #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
   128 #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
   129 #ifdef _MSC_VER
   129 #ifdef _MSC_VER
   130 #pragma warning(disable: 4103)
   130 #pragma warning(disable: 4103)
   131 #endif
   131 #endif
   155 #if defined(_MSC_VER) || defined(__BORLANDC__) || \
   155 #if defined(_MSC_VER) || defined(__BORLANDC__) || \
   156     defined(__DMC__) || defined(__SC__) || \
   156     defined(__DMC__) || defined(__SC__) || \
   157     defined(__WATCOMC__) || defined(__LCC__) || \
   157     defined(__WATCOMC__) || defined(__LCC__) || \
   158     defined(__DECC) || defined(__EABI__)
   158     defined(__DECC) || defined(__EABI__)
   159 #ifndef __inline__
   159 #ifndef __inline__
   160 #define __inline__	__inline
   160 #define __inline__  __inline
   161 #endif
   161 #endif
   162 #define SDL_INLINE_OKAY
   162 #define SDL_INLINE_OKAY
   163 #else
   163 #else
   164 #if !defined(__MRC__) && !defined(_SGI_SOURCE)
   164 #if !defined(__MRC__) && !defined(_SGI_SOURCE)
   165 #ifndef __inline__
   165 #ifndef __inline__