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

📄 从 java 程序调用 c-c++ 代码7.htm

📁 JNI,用JAVA调用C
💻 HTM
📖 第 1 页 / 共 2 页
字号:
        action=http://www-128.ibm.com/developerworks/search/searchResults.jsp 
        method=get>
        <TBODY>
        <TR>
          <TD colSpan=6><IMG height=4 alt="" 
            src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=390 border=0></TD></TR>
        <TR vAlign=center>
          <TD class=dwsearch height=8><SELECT class=dwsearch 
              name=selScope><OPTION value=dW selected>dW 中国所有内容</OPTION><OPTION 
              value=dW>.................</OPTION><OPTION value=dW>dW 
              中国技术专区:</OPTION><OPTION value=comptZ> 组件技术</OPTION><OPTION 
              value=javaZ> Java 技术</OPTION><OPTION 
              value=linuxZ> Linux</OPTION><OPTION 
              value=xmlZ> XML</OPTION><OPTION value=linuxZ>dW 
              中国特别专题:</OPTION><OPTION value=securityZ> 安全</OPTION><OPTION 
              value=unicodeZ> Unicode</OPTION><OPTION value=all>IBM 
            全部内容</OPTION></SELECT></TD>
          <TD class=small><IMG height=1 alt="" 
            src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=5 border=0></TD>
          <TD><INPUT class=dwsearch maxLength=100 size=15 name=UserRestriction 
            height="15"></TD>
          <TD><IMG height=1 alt="" src="从 Java 程序调用 C-C++ 代码7.files/c.gif" 
            width=5 border=0></TD>
          <TD width=64><INPUT type=image height=23 alt=搜索 width=64 
            src="从 Java 程序调用 C-C++ 代码7.files/search.gif" value=Search border=0 
            name=Search></TD>
          <TD vAlign=top><IMG height=1 alt="" 
            src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=34 border=0></TD></TR>
        <TR vAlign=top>
          <TD class=small colSpan=6><A style="COLOR: #ffffff" 
            href="http://www-128.ibm.com/developerworks/cn/search/help-dw.html" 
            target=_blank>高级搜索</A><IMG height=1 alt="" 
            src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=1 border=0></TD></TR>
        <TR>
          <TD colSpan=6><IMG height=4 alt="" 
            src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=390 
        border=0></TD></TR></FORM></TBODY></TABLE></TD></TR>
  <TR>
    <TD class=hbg width=160 height=21></TD>
    <TD class=bbg vAlign=top colSpan=2 height=21>  <A class=mainlink 
      href="http://www-900.ibm.com/cn/">IBM 主页</A><SPAN class=divider> | 
      </SPAN><A class=mainlink 
      href="http://www-900.ibm.com/cn/products/index.shtml">产品与服务</A><SPAN 
      class=divider> | </SPAN><A class=mainlink 
      href="http://www-900.ibm.com/cn/support/index.shtml">支持与下载</A><SPAN 
      class=divider> | </SPAN><A class=mainlink 
      href="http://www-900.ibm.com/cn/account/index.shtml">个性化服务</A></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width=150 bgColor=#ffffff height=1><IMG height=1 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR>
  <TR>
    <TD width=150 bgColor=#cc6633 height=3><IMG height=3 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR>
  <TR>
    <TD width=150 bgColor=#333333 height=1><IMG height=1 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR>
  <TR>
    <TD width=150 bgColor=#000000 height=1><IMG height=1 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR>
  <TR>
    <TD width=150 bgColor=#ffffff height=1><IMG height=2 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD><FONT face="Verdana, sans-serif" size=-1><A 
      href="http://www.ibm.com/">IBM</A> : <A 
      href="http://www.ibm.com/developerworks/cn/index.html">developerWorks 
      中国网站</A> : <A 
      href="http://www-128.ibm.com/developerworks/cn/java/index.html">Java</A> : 
      <A 
      href="http://www-128.ibm.com/developerworks/cn/views/java/tutorials.jsp">教学 
      - 在线教程</A></FONT> <BR><IMG alt="用 JNI 进行 Java 编程" 
      src="从 Java 程序调用 C-C++ 代码7.files/masthead.jpg"></TD>
    <TD vAlign=bottom align=right width=*><A 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni.zip" 
      border="0"><IMG alt="下载 ZIP 文件" 
      src="从 Java 程序调用 C-C++ 代码7.files/icon-zip.gif" border=0></A><IMG alt=英文原文 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" border=0> &nbsp;&nbsp;&nbsp; 
</TD></TR>
  <TR>
    <TD colSpan=2 height=2><IMG height=2 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width=150 bgColor=#000000 colSpan=6 height=1><IMG height=1 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR>
  <TR>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" 
      onmouseout="iOut('topmain'); iOut('bottommain'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/index.html" 
      border="0"><IMG alt=主菜单 src="从 Java 程序调用 C-C++ 代码7.files/main.gif" 
      border=0 name=topmain></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" 
      onmouseout="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/index2.html" 
      border="0"><IMG alt=章节菜单 src="从 Java 程序调用 C-C++ 代码7.files/section.gif" 
      border=0 name=topsection></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" 
      onmouseout="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-5-3.html" 
      border="0"><IMG alt=给出此教程的反馈意见 
      src="从 Java 程序调用 C-C++ 代码7.files/feedback.gif" border=0 
      name=topfeedback></A></TD>
    <TD width="100%" background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><IMG 
      alt="" src="从 Java 程序调用 C-C++ 代码7.files/c.gif"></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" 
      onmouseout="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-2-7.html" 
      border="0"><IMG alt=上页 src="从 Java 程序调用 C-C++ 代码7.files/previous.gif" 
      border=0 name=topprevious></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" 
      onmouseout="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-2-9.html" 
      border="0"><IMG alt=下页 src="从 Java 程序调用 C-C++ 代码7.files/next.gif" border=0 
      name=topnext></A></TD></TR></TBODY></TABLE>
<TABLE height=400 cellSpacing=0 cellPadding=2 width="100%" bgColor=#ffffff 
border=0>
  <TBODY>
  <TR vAlign=bottom></A><A name=navskip></A>
    <TD colSpan=4 height=25><IMG height=25 alt="2.从 Java 程序调用 C/C++ 代码" 
      src="从 Java 程序调用 C-C++ 代码7.files/titlebar2.jpg" width=562 border=0></TD></TR>
  <TR>
    <TD width=15 bgColor=#ffffff>&nbsp;</TD>
    <TD width=12 bgColor=#ffffff>&nbsp;</TD>
    <TD vAlign=top align=left width=* bgColor=#ffffff>
      <P><BR>
      <TABLE cellSpacing=0 cellPadding=0 border=0>
        <TBODY>
        <TR>
          <TD width="90%"><FONT face="Verdana, Arial, Helvetica" size=4><B>关于 
            C/C++ 头文件</B></FONT></TD>
          <TD align=right width=200><FONT face="Verdana, Arial, Helvetica" 
            size=1><NOBR>第 8 页(共16 
      页)</NOBR></FONT></TD></TR></TBODY></TABLE><BR><BR></P><FONT 
      face="Verdana, Arial, Helvetica" size=2>
      <P>正如您可能已经注意到的那样,Sample1.h 中的 C/C++ 函数说明和 Sample1.java 中的 Java 
      <CODE>native</CODE> 方法声明有很大差异。<CODE>JNIEXPORT</CODE> 和 
      <CODE>JNICALL</CODE> 是用于导出函数的、依赖于编译器的指示符。返回类型是映射到 Java 类型的 C/C++ 类型。<A 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-6-1.html">附录 
      A:JNI 类型</A>中完整地说明了这些类型。 </P>
      <P>除了 Java 声明中的一般参数以外,所有这些函数的参数表中都有一个指向 <CODE>JNIEnv</CODE> 和 
      <CODE>jobject</CODE> 的指针。指向 <CODE>JNIEnv</CODE> 
      的指针实际上是一个指向函数指针表的指针。正如将要在步骤 4 中看到的,这些函数提供各种用来在 C 和 C++ 中操作 Java 数据的能力。</P>
      <P><CODE>jobject</CODE> 参数引用当前对象。因此,如果 C 或 C++ 代码需要引用 Java 函数,则这个 
      <CODE>jobject</CODE> 充当引用或指针,返回调用的 Java 
      对象。函数名本身是由前缀“<CODE>Java_</CODE>”加全限定类名,再加下划线和方法名构成的。</P><BR></FONT></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" 
      onmouseout="iOut('topmain'); iOut('bottommain'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/index.html" 
      border="0"><IMG alt=主菜单 src="从 Java 程序调用 C-C++ 代码7.files/main.gif" 
      border=0 name=bottommain></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" 
      onmouseout="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/index2.html" 
      border="0"><IMG alt=章节菜单 src="从 Java 程序调用 C-C++ 代码7.files/section.gif" 
      border=0 name=bottomsection></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" 
      onmouseout="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-5-3.html" 
      border="0"><IMG alt=给出此教程的反馈意见 
      src="从 Java 程序调用 C-C++ 代码7.files/feedback.gif" border=0 
      name=bottomfeedback></A></TD>
    <TD width="100%" background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><IMG 
      alt="" src="从 Java 程序调用 C-C++ 代码7.files/c.gif"></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" 
      onmouseout="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-2-7.html" 
      border="0"><IMG alt=上页 src="从 Java 程序调用 C-C++ 代码7.files/previous.gif" 
      border=0 name=bottomprevious></A></TD>
    <TD background="从 Java 程序调用 C-C++ 代码7.files/sw-gold.gif"><A 
      onmouseover="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" 
      onmouseout="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" 
      href="https://www6.software.ibm.com/developerworks/cn/education/java/j-jni/tutorial/j-jni-2-9.html" 
      border="0"><IMG alt=下页 src="从 Java 程序调用 C-C++ 代码7.files/next.gif" border=0 
      name=bottomnext></A></TD></TR>
  <TR>
    <TD width=150 bgColor=#000000 colSpan=6 height=1><IMG height=1 alt="" 
      src="从 Java 程序调用 C-C++ 代码7.files/c.gif" width=150></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width="100%">
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=1 alt="" src="从 Java 程序调用 C-C++ 代码7.files/c.gif" 
            width=1></TD></TR>
        <TR vAlign=top>
          <TD class=bbg height=21> <A class=mainlink 
            href="http://www-900.ibm.com/cn/ibm/index.shtml">关于 IBM</A><SPAN 
            class=divider> | </SPAN><A class=mainlink 
            href="http://www-900.ibm.com/cn/ibm/privacy/index.shtml">隐私条约</A><SPAN 
            class=divider> | </SPAN><A class=mainlink 
            href="http://www-900.ibm.com/cn/ibm/legal/index.shtml">法律条款</A><SPAN 
            class=divider> | </SPAN><A class=mainlink 
            href="http://www-900.ibm.com/cn/ibm/contact/index.shtml">联系 
          IBM</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript1.2 src="从 Java 程序调用 C-C++ 代码7.files/stats.js" 
type=text/javascript></SCRIPT>
<NOSCRIPT><IMG height=1 alt="" src="G:\ye\从 Java 程序调用 C-C++ 代码7.files\c(1).gif" 
width=1 border=0></NOSCRIPT> </BODY></HTML>

⌨️ 快捷键说明

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