linkage directives
小白vs编程吧
全部回复
仅看楼主
level 6
月无踪 楼主
2012年08月29日 14点08分 1
level 6
月无踪 楼主
The compiler checks calls to external-language functions in the same way that it handlesordinary C++ functions. However, the compiler typically must generate different code to callfunctions written in other languages. C++ uses linkage directives to indicate the languageused for any non-C++ function.
2012年08月29日 14点08分 2
level 6
月无踪 楼主
链接指示:
有两种形式: 单个或者复合的。不能出现在类定义或者函数定义的内部,必须出现在函数的第一次声明上。
2012年08月29日 14点08分 3
level 6
月无踪 楼主
头文件cstdlib中声明的一些C函数:
extern "C" size_t strlen(const char*);
extern "C" {
int strcmp(const char*,const );
char * strcat(char*,const char*);
}
2012年08月30日 10点08分 4
level 6
月无踪 楼主
The first form consists of the extern keyword followed by a string literal, followed by an"ordinary" function declaration. The string literal indicates the language in which the function iswritten.
2012年08月30日 10点08分 5
level 6
月无踪 楼主
2012年08月30日 10点08分 6
level 6
月无踪 楼主
2012年08月30日 11点08分 7
1