不同编译器返回不同类型

/*------------ miscellaneous -----------------------------------------------*/

/**
 * Linkage specification macro
 */
#if !defined(PTAPI_DLL)
 #if defined(BUILD_PTAPI_DLL)
  #if defined(_MSC_VER)
            #if defined(PTAPI_STATIC)
                #if defined __cplusplus
                    #define PTAPI_DLL extern "C"
                #else
                    #define PTAPI_DLL
                #endif
            #else
                #if defined __cplusplus
                    #define PTAPI_DLL extern "C"
                #else
                    #define PTAPI_DLL extern
                #endif
            #endif
  #elif defined(__SYMBIAN32__)
   #if defined(__cplusplus)
    #define PTAPI_DLL extern"C" EXPORT_C
   #else
    #define PTAPI_DLL EXPORT_C
   #endif
  #else
   #if defined(__cplusplus)
    #define PTAPI_DLL extern"C"
   #else
    #define PTAPI_DLL
   #endif
  #endif
 #else
  #if defined(_MSC_VER)
            #if defined(PTAPI_STATIC)
                #if defined __cplusplus
                    #define PTAPI_DLL extern "C"
                #else
                    #define PTAPI_DLL
                #endif
            #else   
       #if defined __cplusplus
        #define PTAPI_DLL extern "C" __declspec(dllimport)
       #else
        #define PTAPI_DLL __declspec(dllimport)
       #endif
            #endif
  #elif defined(__SYMBIAN32__)
   #if defined(__cplusplus)
    #define PTAPI_DLL extern"C" IMPORT_C
   #else
    #define PTAPI_DLL IMPORT_C
   #endif
  #else
   #if defined(__cplusplus)
    #define PTAPI_DLL extern"C"
   #else
    #define PTAPI_DLL
   #endif
  #endif
 #endif
#endif

 

/**
 * Macro for standard call convention
 */
#ifndef PTAPI
#if defined(_MSC_VER)
#if defined(_DOS)
#define PTAPI far
#else
#define PTAPI __stdcall
#endif
#else
#define PTAPI
#endif
#endif

 

/*
nothing doing macros used for better documenting parameter specification
*/

/**
 * This is a definition which has sole purpose of
 * helping readability.  It indicates that formal
 * parameter is an input parameter.
 */
#ifndef IN
#define IN
#endif

/**
 * This is a definition which has sole purpose of
 * helping readability.  It indicates that formal
 * parameter is an output parameter. 
 */
#ifndef OUT
#define OUT
#endif

/**
 * This is a definition which has sole purpose of
 * helping readability.  It indicates that formal
 * parameter is both input and output parameter. 
 */
#ifndef INOUT
#define INOUT
#endif

/**
 * This is a definition which has sole purpose of
 * helping readability.  It indicates that formal
 * parameter is an optional parameter. 
 */
#ifndef OPTIONAL
#define OPTIONAL
#endif


某个.h文件中有这样一段

 

然后.c文件中有PTAPI_DLL  PT_STATUS  PTAPI  PTOpen(。。形参。。。){。函数体。。}

 

经查定义处发现PTAPI_DLL  PT_STATUS  PTAPI只有一个是被定义成long型,其他的均定义为空。经请教别人得知,是为了在不同编译器下返回不同的值。PTAPI_DLL  PT_STATUS  PTAPI只有一个是有效的。

你可能感兴趣的:(不同编译器返回不同值)