这样的定义是什么意思啊

SKATE11 2013-04-20 11:53:27
extern "C"
{
#include "jpeglib.h"
#include "GIFCodec\gif.h"
#include "libpng\png.h"
#include "GIFCodec\bitstr.h"
}
以前没见过 为什么这样定义啊 有什么作用 望高手解答
...全文
172 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
半醉看夕阳 2013-04-20
  • 打赏
  • 举报
回复
这个我也是第一次看到,坐等高手解释下吧
Carl_CCC 2013-04-20
  • 打赏
  • 举报
回复
这个出现在C++里,提醒编译器,请保持我的名称,不要给我生成用于链接的中间函数名。这样就能避免C的代码出现问题。
renyaoming2020 2013-04-20
  • 打赏
  • 举报
回复
自己查msdn
normal_gcg 2013-04-20
  • 打赏
  • 举报
回复
msdn在哪下啊?这种情况我也是第一次见
SKATE11 2013-04-20
  • 打赏
  • 举报
回复
有没有简洁点的中文表达啊
引用 4 楼 zhao4zhong1 的回复:
查MSDN是Windows程序员必须掌握的技能之一。 Mixed-Language Programming with C++ Home | Overview | How Do I C++ uses the same calling convention and parameter-passing techniques as C, but naming c……
赵4老师 2013-04-20
  • 打赏
  • 举报
回复
查MSDN是Windows程序员必须掌握的技能之一。 Mixed-Language Programming with C++ Home | Overview | How Do I C++ uses the same calling convention and parameter-passing techniques as C, but naming conventions are different because of C++ decoration of external symbols. By causing C++ to drop name decoration, the extern "C" syntax makes it possible for a C++ module to share data and routines with other languages. The following example declares prn as an external function using the C naming convention. This declaration appears in C++ source code. extern "C" { void prn(); } To call functions written in Fortran (or MASM), declare the function as you would in C and use a "C" linkage specification. For example, to call the Fortran function FACT from C++, declare it as follows: extern "C" { int __stdcall FACT( int n ); } The extern "C" syntax can be used to adjust a call from C++ to other languages, or to change the naming convention of C++ routines called from other languages. However, extern "C" can be used only from within C++. If the C++ code does not use extern "C" and cannot be changed, you can call C++ routines only by determining the name decoration and generating it from the other language. You can always determine the decoration by using the DUMPBIN utility. Use this approach only as a last resort, because the decoration scheme is not guaranteed to remain the same between versions. Use of extern "C" has some restrictions: You cannot declare a member function with extern "C". You can specify extern "C" for only one instance of an overloaded function; all other instances of an overloaded function have C++ linkage. For more information on the extern "C" linkage specification, see Linkage Specifications in C++ Language Reference.
情歌王子 2013-04-20
  • 打赏
  • 举报
回复
我感觉这是指向头文件路径的地址,便于寻找并精确确定头文件。

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧