extern c 解释
2017-05-28 17:39
225 查看
extern “C”修饰的变量和函数是按照c的方式编译的
如果想用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
相关文章推荐
- extern C的作用具体解释
- extern C 解释
- c#事件与委托的解释
- 谈谈Unicode编码,简要解释UCS、UTF、BMP、BOM等名词(转)
- java反射机制详解 及 Method.invoke解释 getMethod
- git mode 代码解释
- URIEncoding和UseBodyEncodingForURI的解释
- 关于Android Service真正的全然具体解释,你须要知道的一切
- 分销-名词解释
- SAP 系统软件英语缩写解释大集成 ( 未完...待续 )
- Web相关术语解释
- Html5新标签解释及用法
- 类变量、成员变量、实例变量、局部变量、静态变量、全局变量的解释
- 虚拟机类加载相关学习的解释
- GGSN -- 解释
- H.264/AVC结构名词解释
- 一句话解释c#中的特性,你了解多少
- WebService 注解的使用及解释
- 数字信号处理中卷积的图形化动态解释
- 物体检测中名词解释