extern “C”
•通过extern “C”可以要求C++编译器按照C方式处理函数接口,即不做换名,当然也就无法重载
–C调C++,在C++中
extern "C" int add (int x, int y);
extern "C"
{
int add (int x, int y);
int sub (int x, int y);
}
–C++调C,在C++中
extern "C"
{
#include "chead.h"
}
•通过extern “C”可以要求C++编译器按照C方式处理函数接口,即不做换名,当然也就无法重载
–C调C++,在C++中
extern "C" int add (int x, int y);
extern "C"
{
int add (int x, int y);
int sub (int x, int y);
}
–C++调C,在C++中
extern "C"
{
#include "chead.h"
}