c与c++混搭时 extern "C"的使用
来源:互联网 发布:python pause 编辑:程序博客网 时间:2024/04/29 11:48
①C++调用C函数
c.c对应的头文件c.h中使用
#ifdef __cplusplus
extern "C" {
#endif
/* C function declaration */
#ifdef __cplusplus
}
#endif
在cpp.cpp中调用时,#include "c.h"
②C调用C++函数
在cpp.cpp对应的头文件cpp.h中使用
#ifdef __cplusplus
extern "C" {
#endif
/* C++ function declaration */
#ifdef __cplusplus
}
#endif
c.c对应的头文件c.h中使用
#ifdef __cplusplus
extern "C" {
#endif
/* C function declaration */
#ifdef __cplusplus
}
#endif
在cpp.cpp中调用时,#include "c.h"
②C调用C++函数
在cpp.cpp对应的头文件cpp.h中使用
#ifdef __cplusplus
extern "C" {
#endif
/* C++ function declaration */
#ifdef __cplusplus
}
#endif
在c.c中调用时,不要#include "cpp.h",C不能使用extern "C"
而是在c.c或c.h中添加C++函数的声明extern c++ function,就
可以调用啦
0 0
- c与c++混搭时 extern "C"的使用
- “extern c”的使用
- extern “C”的使用
- extern "C"的使用
- extern "C"的使用
- extern "C"的使用
- extern "C"的使用
- extern c 的使用
- extern ”C"的使用
- extern “C”的使用
- extern C的使用
- extern "C"的使用
- extern与extern "C"
- extern与extern “C”
- extern 与 extern "C"
- extern "C" 与 __stdcall使用
- extern "C" 与 __stdcall使用
- extern "C" 与 __stdcall使用
- LeetCode题解——Rotate Array
- 加密过程
- ThreadPoolExecutor 线程池
- md /mdd /ml /mt/mtd
- Android Listview与Checkbox结合实现选择,删除,显示选择结果
- c与c++混搭时 extern "C"的使用
- VS修改项目名后出现的提示(warning MSB8028: The intermediate directory (Debug\) contains files shared from anoth)
- Timer中schedule()的用法
- 黑马程序员——Java语言基础:面向对象、封装(构造函数、设计模式)
- shell的学习笔记——变量的设置规则
- Java相似图片搜索算法之"感知哈希算法"实例
- Thinking in java:泛型
- openfire用户验证知多少
- Java基础教程汇总