I've successfully compiled my library on Linux and Mac and used it with Java Native Access. Unfortunately nothing I do seems to work with Visual Studio's compiler and Java Native Access.
I'm going back to the basics and trying to create a super simple dll in Visual Studio that Java Native Access will work with, any help would be appreciated.
Here's GimmeFiveDll.c:
__declspec(dllexport) int gimmeFive()
{
return 5;
}
Here's SystemLibrary.java:
import com.sun.jna.Native;
public class SystemLibrary {
public static final SystemLibrary instance = new SystemLibrary();
static {
Native.register("GimmeFiveDll");
}
public native int gimmeFive();
}
I have already tried switching the call interface to stdcall in Visual Studio. I did not make any other changes from the new project wizard's empty project dll win32 console defaults.
In the example above the resulting dll doesn't even export the function correctly according to dumpbin.exe /exports
. My real project does export them correctly but either way I always get the same JNA exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'GimmeFiveDll': The specified module could not be found.
(Yes, I put the GimmeFiveDll.dll in System32. Yes I am able to use JNA to access other dlls in System32 that come with Windows).
Anyone willing to help me round out this minimalist example of a dll created by Visual Studio that JNA likes?
Many many thanks.