extern “C”修饰的变量和函数是按照c的方式编译的

如果想用c++方式编译c代码,需要特殊标识

方法

#if defined(__cplusplus) || defined(c_plusplus)
extern "C"{
#endif ... #if defined(__cplusplus) || defined(c_plusplus)
}
#endif

举例

void func(int a, char b, float c){}
# g++ *.cpp -S
# cat *.s
.file "*.cpp"
.text
.globl _Z4funcicf //func+int+char+float
.type _Z4funcicf, @function
#if defined(__cplusplus) || defined(c_plusplus)
extern "C"{
#endif void func(int a, char b, float c){} #if defined(__cplusplus) || defined(c_plusplus)
}
#endif
# g++ *.cpp -S
# cat *.s
.file "*.cpp"
.text
.globl func
.type func, @function

最新文章

  1. java 计算 1到10 的 阶层的和(采用递归的方法)
  2. Python 批量修改文件名
  3. MySQL执行计划解读
  4. postgreSQL绝对值
  5. quick lua 使用spine骨骼动画
  6. noip2011普及组——统计单词数
  7. iOS开发——适配篇&iOS9适配
  8. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(21)-权限管理系统-跑通整个系统
  9. HDU - 1116 Play on Words(欧拉图)
  10. Maven项目pom文件设置JDK版本
  11. js数据结构与算法--双向链表的实现
  12. Hadoop学习------Hadoop安装方式之(二):伪分布部署
  13. James 如何作为服务在后台启动
  14. git stash错误小记
  15. BZOJ5371[Pkusc2018]星际穿越——可持久化线段树+DP
  16. H5使用Swiper过程中遇到的滑动冲突
  17. jquery ready方法实现原理
  18. Laravel 5.4 Cache::put的一个小坑
  19. EF添加Msysql实体异常:表“TableDetails”中列“IsPrimaryKey”的值为 DBNull。 ---> System.InvalidCastException: 指定的转换无效。
  20. 使用html+css+js实现计算器

热门文章

  1. web手工项目03-登录功能测试用例及缺陷编写-流程图画法-前后台下单及发货流程图-流程图设计测试用例方法-功能测试涉及到的四种数据库场景
  2. JS 时间处理(GMT转换,超24小时加一天,时间差计算)
  3. mariadb升级
  4. (十六)Centos之安装mysql
  5. Mysql coalesce()函数认识和用法
  6. migrate设置
  7. Composer更新慢的终极解决方案-转
  8. 【馨儿收藏】群星《2019最新好听DJ舞曲精选》全系列【WAV/在线/百度】(持续更新)
  9. SSRF——漏洞利用(二)
  10. 多线程调用有参数的方法---c# Thread 与 Task