ifdefine __cplusplus extern c{}的作用
来源:互联网 发布:logo图标快速生成软件 编辑:程序博客网 时间:2024/06/02 02:16
#ifdef c__plusplus extern "c"{ #endif ... #ifdef c__plusplus } #endif这个.h文件被cpp文件include后,它告诉了cpp的编译器,被extern c 括起来的部分是c函数,在编译时,保持c风格的函数名。也就是说c编译出来的库,用extern c在头文件中括起,是为了方便cpp调用。
这说明,宏c__plusplus 是c++编译器内定的。extern "c" 也由c++编译器处理。
如果c++的库要给c调用,显然,不但要在c++头文件中用该宏和extern "c"括起,在cpp中也要这么做。原因就是让cpp编译器将那些代码,编译成c风格。
根本原因:c++和c编译时同一函数原型产生的函数名不同。
阅读全文
0 0
- ifdefine __cplusplus extern c{}的作用
- ifdefine __cplusplus extern c{}的作用
- __cplusplus,extern "C"的作用
- #ifdef __cplusplus extern c #endif 的作用
- extern "C" 的原因 __cplusplus
- ifdefine的作用
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- “#ifdef __cplusplus extern "C" { #endif”的定义
- “#ifdef __cplusplus extern "C" { #endif”的定义
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern C的功能
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- #ifdef __cplusplus extern "C" { #endif 的解释
- [YTU]_2474( C++习题 输入输出--保护继承)
- Bootstrap Table使用整理(五)-分页组合查询
- touch事件计算滑动距离
- [YTU]_2621(B 继承 圆到圆柱体)
- ios 访问权限获取
- ifdefine __cplusplus extern c{}的作用
- 汇编复习题 Test1
- 我们所说的前端框架与库的区别?
- [YTU]_2532(投简历)
- Tensorflow serving(tf_serving) 安装测试说明
- 第3章 模板
- 基于Hough变换的直线和圆的检测与提取
- 自定义ViewGroup练习一
- 【web开发-协议】HTTP协议