Hi,
I am trying to do this:
package
jnatest;
import
com.sun.jna.Library;
import
com.sun.jna.Native;
public
abstract class testJNALibHelper implements Library {
public static testJNALibHelper INSTANCE =
(testJNALibHelper)Native.loadLibrary("D:/MyPath/CPPDynamicLibToBeCalledViaJNA",
testJNALibHelper.
class);
public abstract int SetValue(int i);
}
where CPPDynamicLibToBeCalledViaJNA is the name of my dll.
and to call my C++ static SetValue method as follows:
testJNALibHelper lib = testJNALibHelper.
INSTANCE;
for(int i=0;i<5;i++){
System.out.println("Returned value is " + testJNALibHelper.lib.SetValue(i));
}
What is wrong?
How can I set the jna.library.path system property?
The following:
java.lang.System.setProperty("jna.library.path","D:/Mypath");
and the following:
NativeLibary.addSearchPath("CPPDynamicLibToBeCalledViaJNA","D:/Mypath");
both do not compile.
I guess that just the last is recommended.
Thank you in advance for your help.
Piotr