转自Ibm:

Name mangling is the encoding of function and variable names into unique names so that linkers can separate common names in the language. Type names may also be mangled. The compiler generates function names with an encoding of the types of the function arguments when the module is compiled. Name mangling is commonly used to facilitate the overloading feature and visibility within different scopes. Name mangling also applies to variable names. If a variable is in a namespace, the name of the namespace is mangled into the variable name so that the same variable name can exist in more than one namespace. The C++ compiler also mangles C variable names to identify the namespace in which the C variable resides.

The scheme for producing a mangled name differs with the object model used to compile the source code: the mangled name of an object of a class compiled using one object model will be different from that of an object of the same class compiled using a different object model. The object model is controlled by compiler option or by pragma.

Name mangling is not desirable when linking C modules with libraries or object files compiled with a C++ compiler. To prevent the C++ compiler from mangling the name of a function, you can apply the extern "C" linkage specifier to the declaration or declarations, as shown in the following example:

extern "C" {
int f1(int);
int f2(int);
int f3(int);
};

This declaration tells the compiler that references to the functions f1, f2, and f3 should not be mangled.

The extern "C" linkage specifier can also be used to prevent mangling of functions that are defined in C++ so that they can be called from C. For example,

extern "C" {
void p(int){
/* not mangled */
}
};
http://blog.csdn.net/xt_xiaotian/article/details/5431410
http://www.360doc.com/content/11/0402/17/6295074_106726950.shtml http://www.geeksforgeeks.org/extern-c-in-c/

最新文章

  1. PHP+Mysql+jQuery实现地图区域数据统计-展示数据
  2. Uncaught TypeError: _react2.default.findDOMNode is not a function
  3. jQuery添加删除元素
  4. CentOS7+JDK8编译Hadoop2.6.4
  5. EOF的一点注记
  6. “惊群”,看看nginx是怎么解决它的
  7. NYOJ-32 组合数 AC 分类: NYOJ 2014-01-02 22:21 112人阅读 评论(0) 收藏
  8. PHP 时间函数集合
  9. jackson的简单使用(可转xml)
  10. 简述uwsgi使用一个服务启动多个文件的用法
  11. MVC5的控制器,使用HttpPost方式时,接收的参数为null的原因
  12. Github+Hexo搭建静态博客
  13. 【Flask】 结合wtforms的文件上传表单
  14. Flask 文件和流
  15. springmvc的日期类型转换
  16. java常见错误总结
  17. Python图形编程探索系列-03-标签组件(Label)
  18. TypeScript 之 函数
  19. [z]表空间对应文件的AUTOEXTEND ON NEXT指定的值对性能的影响
  20. PHP 获取两个时间之间的月份

热门文章

  1. SQL语句中格式化时间
  2. 动态树 Link-Cut Trees
  3. Binding 中 Elementname,Source,RelativeSource 三种绑定的方式
  4. Mysql INNER,LEFT ,RIGHT join的使用
  5. ASP.NET MVC——Controller的激活
  6. 监听EditText的变化
  7. JAVA 相关资料
  8. Linux同步时间命令ntpdate
  9. SQL SERVER while循环
  10. C#常用的关键字