I'm trying to use:
32 bit DLL (built with Visual Studio 2015) on a 32 bit JVM running application, on a Windows 7 64 bit machine
64 bit DLL (built with Visual Studio 2015) on a 64 bit JVM running application, on a Windows 7 64 bit machine
The DLL has a few provided dependencies, but I've set up the 'jna.library.path' to the folder containing all required dependencies so jna should be able to find them. I also added the folder containing the DLL and its dependencies to 'java.library.path' to make sure they are found.
In both cases, unfortunately, I get the
java.lang.UnsatisfiedLinkError: Unable to load library.
Some other points to consider:
If I launch my application from the directory containing the libraries, it runs without any problem. Does this indicates a problem with DLL search path for loading?
I was previously building the library with Visual Studio 2010, and I was able to load the libraries without a problem. Could this be an issue with the DLL build?
Any ideas on what could be the issue?
I've enabled 'jna.debug_load' and 'jna.debug_load.jna' and the log shows that the correct path is tried but the load still fails (I've checked and rechecked that in both scenarios the correct lib is available at C:\path\to\my\lib[32/64]\xxx.dll). The following log is for the 32 bit DLL loading, but the exact same result happens with the 64 bit DLL.
...snip...
Trying (via loadLibrary) jnidispatch
Looking in classpath from ...[...] for x86/jnidispatch.dll
Found library resource at bundleresource://449.fwk22856250/com/sun/jna/win32-x86/jnidispatch.dll
Trying C:\...snip...\AppData\Local\Temp\jna--892366855\jna1523529206075569309.dll
Found jnidispatch at C:\...snip...\AppData\Local\Temp\jna--892366855\jna1523529206075569309.dll
Looking for library 'xxx'
Adding paths from jna.library.path: C:/path/to/my/lib32
Trying C:\path\to\my\lib32\xxx.dll
Adding system paths: []
Trying C:\path\to\my\lib32\xxx.dll
Looking for lib- prefix
Trying libxxx.dll
Looking in classpath from ...[...]
...
java.lang.UnsatisfiedLinkError: Unable to load library 'xxx': Native library (win32-x86/xxx.dll) not found in resource path...
...snip...