Surprisingly, the following can be used as well:
final File dll = new File("src/lib/Tester32.dll");
Test32 test32 = (Test32) Native.loadLibrary(dll.getAbsolutePath(), Test32.class);
System.out.println(test32.toString() + " - " + test32.GetLastError());
It outputs:
Proxy interface to Native Library <C:\workspace\jna\src\lib\Tester32.dll@387842048> - 0
Javadoc says:
loadLibrary
public static Object
loadLibrary(String name,
Class interfaceClass)
Map a library interface to the given
shared library, providing the explicit
interface class. If name is null,
attempts to map onto the current
process.
If I rename Tester32.dll
in .\src\lib
folder to something else, following exception will occur:
Exception in thread "main"
java.lang.UnsatisfiedLinkError: Unable
to load library
'C:\workspace\jna\src\lib\Tester32.dll':
The specified module could not be
found.