⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extern c_usage.htm

📁 该压缩包包含extern C的基本用法
💻 HTM
📖 第 1 页 / 共 2 页
字号:
            0;<BR>}<BR>但是把链接指示符放在头文件中更合适在那里函数声明描述了函数的接口所属<BR>如果我们希望C++函数能够为C 
            程序所用又该怎么办呢我们也可以使用extern "C"<BR>链接指示符来使C++函数为C 程序可用例如<BR>// 函数calc() 
            可以被C 程序调用<BR>extern "C" double calc( double dparm ) { /* ... */ 
            }<BR>如果一个函数在同一文件中不只被声明一次则链接指示符可以出现在每个声明中它<BR>也可以只出现在函数的第一次声明中在这种情况下第二个及以后的声明都接受第一个声<BR>明中链接指示符指定的链接规则例如<BR>// 
            ---- myMath.h ----<BR>extern "C" double calc( double );<BR>// ---- 
            myMath.C ----<BR>// 在Math.h 中的calc() 的声明<BR>#include 
            "myMath.h"<BR>// 定义了extern "C" calc() 函数<BR>// calc() 可以从C 
            程序中被调用<BR>double calc( double dparm ) { // ...<BR>在本节中我们只看到为C 
            语言提供的链接指示extern "C" extern 
            "C"是惟一被<BR>保证由所有C++实现都支持的每个编译器实现都可以为其环境下常用的语言提供其他链接<BR>指示例如extern 
            "Ada"可以用来声明是用Ada 语言写的函数extern "FORTRAN"用来<BR>声明是用FORTRAN 
            语言写的函数等等因为其他的链接指示随着具体实现的不同而不同<BR>所以建议读者查看编译器的用户指南以获得其他链接指示符的进一步信息</SPAN><BR>
            <P align=right>出处: </P></TD></TR>
        <TR>
          <TD width="100%">
            <TABLE class=pageSeparator cellSpacing=0 cellPadding=1 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD align=right><A title=下一篇 
                  href="http://www.7622.com/list/49061.htm"><IMG height=15 
                  src="extern C的用法.files/next.gif" align=absMiddle border=0> 
                  <SPAN 
                  style="FONT-SIZE: 10px; COLOR: #990000; FONT-FAMILY: verdana"><B>Next</B></A> <A 
                  onclick=window.close(); href="javascript:;"><IMG height=15 
                  src="extern C的用法.files/close.gif" width=48 align=absMiddle 
                  border=0></A> <A 
                  href="http://www.7622.com/list/49060.htm#top"><IMG height=15 
                  src="extern C的用法.files/top.gif" width=38 align=absMiddle 
                  border=0></A></SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
    <TD class=columnContent vAlign=top align=middle width=220>
      <TABLE cellSpacing=0 cellPadding=6 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=listTitle>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><STRONG>作者文章</STRONG></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=listContent vAlign=top><!-作者top-></TD></TR></TBODY></TABLE>
      <TABLE class=border cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=6 src="extern C的用法.files/spacer.gif" 
        width=6></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=6 width="100%" border=0>
        <FORM action=http://www.google.com/custom method=get target=_top>
        <TBODY>
        <TR>
          <TD class=columnTitle>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><A href="http://www.google.com/" target=_blank><IMG 
                  src="extern C的用法.files/google_logo.gif" border=0></A></TD>
                <TD align=right>范围:<INPUT type=radio value="" 
                  name=sitesearch></INPUT>全网 <INPUT type=radio CHECKED 
                  value=7622.com 
          name=sitesearch></INPUT>本站</TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=columnContent><FONT color=red>推荐使用</FONT> <INPUT 
            maxLength=255 size=15 name=q></INPUT> <INPUT type=hidden 
            value=7622.com name=domains></INPUT> <INPUT type=submit value=搜索 name=sa></INPUT> <INPUT type=hidden 
            value=pub-5841412030047197 name=client></INPUT> <INPUT type=hidden 
            value=1 name=forid></INPUT> <INPUT type=hidden value=6876763258 
            name=channel></INPUT> <INPUT type=hidden value=GB2312 
            name=ie></INPUT> <INPUT type=hidden value=GB2312 name=oe></INPUT> 
            <INPUT type=hidden 
            value=GALT:008000;GL:1;DIV:336699;VLC:551A8B;AH:left;BGC:F2F3F7;LBGC:#8C8EA3;ALC:0000CC;LC:CC0033;T:000000;GFNT:#7777CC;GIMP:cc0033;LH:50;LW:778;L:/img/google_search_title.gif;S:;FORID:1; 
            name=cof></INPUT> <INPUT type=hidden value=zh-CN name=hl></INPUT> 
        </TD></TR></FORM></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=border><IMG height=6 src="extern C的用法.files/spacer.gif" 
            width=6></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=6 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=columnTitle>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><STRONG>站内搜索</STRONG> 
      </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE class=columnContent cellSpacing=6 cellPadding=0 width="100%" 
      border=0>
        <FORM name=search action=../search.asp method=post><INPUT type=hidden 
        value=executeSearch name=action> 
        <TBODY>
        <TR>
          <TD><INPUT style="WIDTH: 70px" size=10 name=key> </TD>
          <TD><SELECT name=searchby> <OPTION value=title 
              selected>标题</OPTION> <OPTION value=author>作者</OPTION></SELECT> </TD>
          <TD><INPUT type=image height=19 width=46 
            src="extern C的用法.files/searchbutton.gif" border=0 name=submit2> 
        </TD></TR></FORM></TBODY></TABLE>
      <TABLE class=border cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=6 src="extern C的用法.files/spacer.gif" 
        width=6></TD></TR></TBODY></TABLE>
      <TABLE class=listcontent cellSpacing=0 cellPadding=6 width="100%" 
border=0>
        <TBODY>
        <TR>
          <TD class=listTitle>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><STRONG>站点最新</STRONG></TD>
                <TD align=right> </TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD vAlign=top>
            <TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><IMG height=13 src="extern C的用法.files/arrow.gif" width=4> 
                  <A href="http://www.7622.com/list/56337.htm">在spring 
                  MVC框架中显示xml视图</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56336.htm">Lesson 1.02 
                  Ant的安装和配置 </A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56335.htm">关于UI管理器的设计(草案)方案</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56334.htm">osworkflow API 之 
                  com.opensymphony.workflow</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56333.htm">什么是模式?什么是框架?</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56332.htm">对数据库查询,更新的封装处理(原创)</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56331.htm">Eclipse In 
                  Action2.1</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56330.htm">Eclipse In 
                  Action1.4</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56329.htm">Eclipse In 
                  Action1.3</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56328.htm">【翻译】Managed 
                  DirectX(第七章) </A><BR></TD></TR>
              <TR>
                <TD class=dotLine 
      colSpan=2></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE class=border cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=6 src="extern C的用法.files/spacer.gif" 
        width=6></TD></TR></TBODY></TABLE>
      <TABLE class=listcontent cellSpacing=0 cellPadding=6 width="100%" 
border=0>
        <TBODY>
        <TR>
          <TD class=listTitle>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD><STRONG>栏目最新</STRONG></TD>
                <TD align=right> </TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=list vAlign=top>
            <TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
              <TBODY>
              <TR>
                <TD height=10><IMG height=13 src="extern C的用法.files/arrow.gif" 
                  width=4> <A 
                  href="http://www.7622.com/list/56327.htm">翻译:Effective C++, 
                  3rd Edition, Item 25: 考虑支持不抛异常的 swap(上)</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56325.htm">[原创] 自己写着玩之一: ini 
                  解析器</A><BR><IMG height=13 src="extern C的用法.files/arrow.gif" 
                  width=4> <A href="http://www.7622.com/list/56323.htm">C++ 
                  Builder VCL库函数简介(3)</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56322.htm">C++ Builder 
                  VCL库函数简介(1)</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56321.htm">Ruby中的Continuation</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56308.htm">电脑硬件, 韧体, 
                  驱动工程师必备工具</A><BR><IMG height=13 
                  src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56306.htm">使用PHP往Windows系统中添加用户</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56300.htm">2006发展趋势--双核心是热点</A><BR><IMG 
                  height=13 src="extern C的用法.files/arrow.gif" width=4> <A 
                  href="http://www.7622.com/list/56299.htm">C++字符串完全指南(2) - 
                  MFC类</A><BR><IMG height=13 src="extern C的用法.files/arrow.gif" 
                  width=4> <A 
                  href="http://www.7622.com/list/56297.htm">如何使页面上的图片实现水印的效果?</A><BR></TD></TR>
              <TR>
                <TD class=dotLine 
      colSpan=2></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE class=border cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=6 src="extern C的用法.files/spacer.gif" 
        width=6></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE class=border cellSpacing=6 cellPadding=0 width=778 border=0>
  <TBODY>
  <TR>
    <TD class=navLight>
      <TABLE height=42 cellSpacing=12 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD>
            <CENTER><FONT color=#ffffff>2005 7622.com 
        版权没有</FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<SCRIPT src="extern C的用法.files/mystat.htm"></SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -