C 函数中调用 C++函数 | |
class class1 { int getI(void); #endif // cpp.cpp using namespace std; // 打开标准库名字空间 class1::class1() class1::~class1() int class1::getI(void) // 按 C 调用方式编译下面函数 cout << "c++: " << pClass1->getI() << endl; return pClass1->getI(); // end file // c.h #ifdef __cplusplus typedef struct { #ifdef __cplusplus // c.c extern int get_class1_I(void * p); struct1 s; int main(void) // end file 参考了eCos中的混和编程实现方式(http://sources.redhat.com/ecos/)。 本例在ADS 1.2中编译通过,执行结果正确。 |
C 函数中调用 C++函数
最新推荐文章于 2022-06-29 11:27:37 发布