C++ 语言链接性

启言:每个函数定义都有链接器可识别的独一无二的编译后的函数名称

种类:C 语言链接性、C++ 语言链接性,可能有如下的编译器翻译

spiff( int ) _spiff // C
spiff( int ) _spiff_i // C++ (函数重载)
spiff(double, double) _spiff_d_d // C++ (函数重载)

  

使用函数声明指出要使用的约定(使用C库还是C++库中的函数):

extern "C" void spiff( int );    // use C protocol for name look-up
extern void spiff( int );    // use C++ protocol for name look-up (默认 C++)
extern "C++" void spiff( int );    // use C++ protocol for name look-up (显示 C++)

  

猜你喜欢

转载自www.cnblogs.com/suui90/p/12913178.html