2017-01-27 53 views
1

從Java調用Corelis Jtag USB-1149.1_1E的DLL方法時遇到困難,儘管我可以從labview調用它。 在Corelis用戶指南scan_multiple中有五個參數。但data_in是一個返回值,因此,我不認爲它應該是一個參數/輸入。 我應該如何在Java中構建我的scan_Multiple()?有多少個參數?在Java中調用Jtag DLL方法(scan_multiple)

文件:

int scan_Multiple(const long n_commands,const unsigned long *method,const unsigned short *data_out,unsigned long *bit_length,unsigned short *data_in) 

代碼:

public class HelloWorld { 

    public native int scan_Multiple(long n1, long n2, short n3, long n4, short n5); 

    // private native void print(); 
    public static void main(String[] args){ 
     System.loadLibrary("usb1e_sfl_x64"); 
     HelloWorld sample = new HelloWorld(); 
     System.out.println("test1"); 
     long n1 = 1000; 
     long n2 = 1000; 
     short n3 = 2; 
     long n4 = 2; 
     short n5 = 2; 
     System.out.println(n1 + " " + n2 + " " + n3); 
     int test222 = sample.scan_Multiple(n1,n2,n3,n4,n5); 
     System.out.println("test2" + n1 + n2 + n3 + n4 + n5 + test222); 
     // usb1e_sfl_x64 sample = new usb1e_sfl_x64(); 
     // int test = sample.scan_multiple 
    } 
    static{ 
     // System.loadLibrary("usb1e_sfl_x64"); 
    } 
} 

回答

0

嘗試用類包裝

Short n5; 

這樣的參數將通過引用傳遞到盒DATA_IN,並應具有開啓功能返回所需的數據。