#ifdef __cplusplus是什么意思?
Microsoft-Specific Predefined Macros
__cplusplus Defined for C++ programs only.
意思是说,如果是C++程序,就使用
extern "C"{
而这个东东,是指在下面的函数不使用的C++的名字修饰,而是用C的
The following code shows a header file which can be used by C and C++ client applications:
// MyCFuncs.h
#ifdef __cplusplus
extern "C" { // only need to export C interface if
// used by C++ source code
#endif
__declspec( dllimport ) void MyCFunc();
__declspec( dllimport ) void AnotherCFunc();
#ifdef __cplusplus
}
#endif
博客介绍了#ifdef __cplusplus的含义,它仅在C++程序中被定义。当是C++程序时,使用extern \C\可让下面的函数不使用C++名字修饰,而用C的。还给出了一个可被C和C++客户端应用使用的头文件示例。
960

被折叠的 条评论
为什么被折叠?



