We often see the symbol extern "C"  in C++ source files.
Why use this?
Because C++ has overload function property like:
 
f(int i)      //defines f__Fi
f(int i ,char* j) //defines f__FiPc
 
When we link in other file
extern f(int);  // refers to f__FI
extern f(int,char*)  // refers to f__FiPc
 
But the C programming language's link symbol is not like this , because C don't have overload function.
 
int C:
f(int)  // defines _f
 
So, if we want use C lib , we must tell the compiler the link symbol is C style.
extern "C"{
   int f(int i);
}

相关文章:

  • 2021-12-22
  • 2022-02-11
  • 2022-01-07
  • 2022-12-23
  • 2021-07-10
  • 2022-01-10
  • 2021-04-12
猜你喜欢
  • 2021-08-20
  • 2021-06-09
  • 2021-11-15
  • 2021-09-28
  • 2021-08-04
  • 2021-07-24
  • 2021-08-20
相关资源
相似解决方案