!!!!! Test file, the function name SpectrumH_IDP, input floating-point one-dimensional array, the output 1 long integer, floating point one dimensional array output 2.!!!!!
Now please look at my code, I wrote a DLL ran fine
Jna interface
Package com.com pany. InterJNA;
The import com. Sun. Jna. Library;
The import com. Sun. Jna. Native;
The import com. Sun. Jna. Platform;
The import com. Sun. Jna. Pointer;
Public interface JNA extends Library {
//public int Transfer_Ethernet_EX (String filename, int key);
//public int Transfer_Ethernet (String filename);
JNA testdll=(JNA) Native. The load (" C: \ \ Users \ \ LIJIAZ \ \ source \ \ repos \ \ testdll \ \ Release \ \ testdll ", JNA. Class);
Int the add (int a, int b);
JNA lv=(JNA) Native. The load (" C: \ \ Users \ \ LIJIAZ \ \ Desktop \ \ JNA \ \ lvanlys ", JNA. Class);
Long SpectrumH_IDP (Pointer xH, long f);
}
The main main function
Package com.com pany. InterJNA;
The import com. Sun. Jna. Library;
The import com. Sun. Jna. Native;
The import com. Sun. Jna. Platform;
The import com. Sun. Jna. Pointer;
Public interface JNA extends Library {
//public int Transfer_Ethernet_EX (String filename, int key);
//public int Transfer_Ethernet (String filename);
JNA testdll=(JNA) Native. The load (" C: \ \ Users \ \ LIJIAZ \ \ source \ \ repos \ \ testdll \ \ Release \ \ testdll ", JNA. Class);
Int the add (int a, int b);
JNA lv=(JNA) Native. The load (" C: \ \ Users \ \ LIJIAZ \ \ Desktop \ \ JNA \ \ lvanlys ", JNA. Class);
Long SpectrumH_IDP (Pointer xH, long f);
}
Because I don't know SpectrumH_IDP function of the second parameter type I'll write some luck
An error
System===true
DLL add value=https://bbs.csdn.net/topics/4
4
The Exception in the thread "main" Java. Lang. Error: Invalid memory access
At com. Sun. Jna. Native. InvokeLong (Native Method)
At com. Sun. Jna. Function. Invoke (428) Function. The Java:
At com. Sun. Jna. Function. Invoke (361) Function. The Java:
At com. Sun. Jna. Library $Handler. Invoke (265) Library. Java:
At sun. Proxy. $Proxy0. SpectrumH_IDP (Unknown Source)
At com.com pany. Main. The Main (the Main Java from InputFileObject: 21)
4
The Process finished with exit code 1
Can I write my own normal output second DLL is online type mismatch
Int32_t SpectrumH_IDP (void * xH, InstanceDataPtr * tidp
For help sigh bosses got several weeks
CodePudding user response:
Bosses come ahhhCodePudding user response:
CodePudding user response:
Eldest brother big uncle deke great god daxian greatly greatly