zoukankan      html  css  js  c++  java
  • JNative 传递参数bug

     下载JNative网址:http://sourceforge.net/projects/jnative/files/jnative/

     下载JNative版本:JNative_1.4RC3_bin.zip

     bug描述:

                Test.dll中有个方法fnTest有五个参数,方法签名如下:

               void  fnTest(double a,double b,double c,double d,int e);

                

                当用JNative调用时如下:

    public void fnTest() throws NativeException, IllegalAccessException {  
            JNative fnTest=null;
    try { fnTest= new JNative("Test.dll", "fnTest"); fnTest.setParameter(0, Type.DOUBLE, "111.111"); fnTest.setParameter(1, Type.DOUBLE, "222.222"); 
      fnTest.setParameter(2, Type.DOUBLE, "333.333"); 
      fnTest.setParameter(3, Type.DOUBLE, "444.444"); 
      fnTest.setParameter(4, Type.INT, "5");  fnTest.setRetVal(Type.VOID); fnTest.invoke();

    } finally { if (fnTest!= null) { fnTest.dispose(); } } }

             代码运行起来后,到 Test.dll中的fnTest方法,发现参数a=444.444 b=333.333 c=222.222 d=111.111
             没有看源代码,具体原因不知道。

             将代码修改如下:

    public void fnTest() throws NativeException, IllegalAccessException {  
            JNative fnTest=null;        try {    
               fnTest= new JNative("Test.dll", "fnTest");  
               fnTest.setParameter(3, Type.DOUBLE, "111.111");  
               fnTest.setParameter(2, Type.DOUBLE, "222.222"); 
    fnTest.setParameter(1, Type.DOUBLE, "333.333");
    fnTest.setParameter(0, Type.DOUBLE, "444.444");
    fnTest.setParameter(4, Type.INT, "5"); fnTest.setRetVal(Type.VOID); fnTest.invoke(); } finally { if (fnTest!= null) { fnTest.dispose(); } } }


    调用成功,问题搞定!!!

  • 相关阅读:
    ORACLE日期时间函数大全
    orcal基础
    javaweb学习总结——基于Servlet+JSP+JavaBean开发模式的用户登录注册
    一个DataTable赋值给另一个DataTable的常用方法
    ios开发 解释器和编译器
    ios面试题(五)-多线程
    ios面试题(四)-block
    ios面试题(三)
    ios开发面试题(二)
    ios开发面试题(一)
  • 原文地址:https://www.cnblogs.com/beipiaofeng/p/3486255.html
Copyright © 2011-2022 走看看