-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hello, hope I can find solutions to my problem
previously, I used JNA "4.1.0" to access to SiUSBXp.dll which is compiled for '32bit' and it working fine with JVM 32bit ...
Now I upgrade my operating system to 64bit (windows 7 ) .. and I used same previous java program with (64bit) compiled dll, JVM jdk1.8.0_151 (64 bit) and JNA 4.1.0, it gives several problems during USB sending and receiving data
1- sometimes java application give "Invalid memory access" Exception
2- sometimes return wrong number Example (-134127606 instead of 3 ) using IntByReference
those problems never happened before with 32bit setting
I tested the dll which compiled for 64 bit using C++ application and it works without any problem.
Also, I tried to use different version of JNA 4.5.0 but "always: give Invalid memory access
this is the function which causes the problems
c++ : SI_STATUS SI_Write (HANDLE Handle, LPVOID Buffer, DWORD NumBytesToWrite,
DWORD NumBytesWritten, OVERLAPPED o = NULL)
Java I tried both declaration and both were working well with 32bit setting
int SI_Write (HANDLE Handle, byte[] lpBuffer, int dwBytesToWrite, IntByReference lpdwBytesWritten); int SI_Write (HANDLE Handle,Pointer lpBuffer, int dwBytesToWrite, IntByReference lpdwBytesWritten);
Thanks in advance