From | Sent On | Attachments |
---|---|---|
Christine Grudecki | Jul 26, 2007 7:11 am | |
Timothy Wall | Jul 26, 2007 8:35 am | |
Christine Grudecki | Jul 26, 2007 12:53 pm | |
Timothy Wall | Jul 26, 2007 1:21 pm | |
pzab...@poczta.onet.pl | Jul 27, 2007 8:57 am | |
Timothy Wall | Jul 27, 2007 11:25 am | |
Timothy Wall | Jul 30, 2007 3:41 am | |
Timothy Wall | Jul 30, 2007 7:54 am | |
Timothy Wall | Jul 30, 2007 8:59 am | |
Christine Grudecki | Jul 30, 2007 9:25 am | |
Timothy Wall | Jul 30, 2007 10:50 am |
Subject: | NativeLibrary Usage | ![]() |
---|---|---|
From: | pzab...@poczta.onet.pl (pzab...@poczta.onet.pl) | |
Date: | Jul 27, 2007 8:57:33 am | |
List: | net.java.dev.jna.users |
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