我在读opengl es的书,在源代码中发现了这个宏

///
//  Macros
//
#define ESUTIL_API
#define ESCALLBACK

在实现文件的后面.c
void ESUTIL_API esInitContext ( ESContext *esContext )
{
   if ( esContext != NULL )
   {
     memset( esContext, 0, sizeof( ESContext) );
   }
}

根据我对宏的理解,它们只是替换宏定义的内容。。尽管我不明白这件事的意义。
谢谢。

最佳答案

此类宏用于更改编译器使用的调用约定:

#define ESUTIL_API  // nothing, use the standard calling convention


#define ESUTIL_API __fastcall // use the fastcall calling convention

调用类型调用约定通常必须放在返回类型和函数标识符名称之间的函数定义中。

关于c - 这个C宏的目的是什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11646866/

10-10 15:37