Ignore:
Timestamp:
18.09.2011 13:26:19 (8 years ago)
Author:
stefan.ruppert@…
Message:

#8 fixed calling convention problem under linux/x86 32-bit due to wrong usage of pre-defined pre-processor defines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arm4sdk/trunk/c/include/arm4sdk.h

    r1 r13  
    5454/*                                                                           */ 
    5555/* ------------------------------------------------------------------------- */ 
    56 /* Each OS platform needs to define the API calling convention for itself,   */ 
    57 /* and make sure the proper compiler keywords are used.                      */ 
    58 /*      ARM4SDK_API_CALL is for API calls with fixed # of parameters, while     */ 
    59  
    60 #if defined(_WIN32) || defined(_WIN64) 
    61 /* For 32-bit and 64-bit Windows, "stdcall" (pascal) calling convention is   */ 
    62 /* explicitly chosen for ARM4SDK_API_CALL to save a few instructions per call.  */ 
    63 #if defined(__GNUC__) 
    64 #define ARM4SDK_API_CALL    __attribute__((stdcall)) 
    65 #else 
    66 /* If a compiler does not support __stdcall or __cdecl, it will generate     */ 
    67 /* compile time errors when encountering these modifiers. Most compilers,    */ 
    68 /* e.g. _MSC_VER, __WATCOMC__, __BORLANDC__ and __MWERKS__ do support both.  */ 
    69 /* __INTEL_COMPILER knows both, too.                                         */ 
    70 #define ARM4SDK_API_CALL    __stdcall 
    71 #endif 
    72 #endif /* _WIN32 || _WIN64 */ 
    73  
    74 #if defined(linux) 
    75  
    76 #if defined(__GNUC__) 
    77  
    78 #if defined(__i386__) 
    79 #define ARM4SDK_API_CALL    __attribute__((stdcall)) 
    80 #endif 
    81  
    82 #elif !defined(__INTEL_COMPILER) 
    83 /* On linux the intel compiler doesn't support __stdcall !?!*/ 
    84 #define ARM4SDK_API_CALL    __stdcall 
    85  
    86 #endif 
    87 #endif /* linux ; END of ARM4SDK_API_CALL define section*/ 
    88  
    89 /* For other OS platforms, the compiler's default calling convention is used */ 
    90 /* and, hopefully, this won't cause link-time or run-time problems.          */ 
    91 #if !defined(ARM4SDK_API_CALL) 
    92 #define ARM4SDK_API_CALL 
    93 #endif 
     56 
     57 
     58/* We use the same calling convention as the standard ARM4 API calls */ 
     59#define ARM4SDK_API_CALL ARM4_API_CALL 
    9460 
    9561/* Set up the ARM4SDK_API_DYNAMIC definition here so the ARM library can be     */ 
Note: See TracChangeset for help on using the changeset viewer.