atom feed11 messages in net.java.dev.jna.usersNativeLibrary Usage
FromSent OnAttachments
Christine GrudeckiJul 26, 2007 7:11 am 
Timothy WallJul 26, 2007 8:35 am 
Christine GrudeckiJul 26, 2007 12:52 pm 
Timothy WallJul 26, 2007 1:21 pm 
pzab...@poczta.onet.plJul 27, 2007 8:57 am 
Timothy WallJul 27, 2007 11:24 am 
Timothy WallJul 30, 2007 3:41 am 
Timothy WallJul 30, 2007 7:54 am 
Timothy WallJul 30, 2007 8:58 am 
Christine GrudeckiJul 30, 2007 9:24 am 
Timothy WallJul 30, 2007 10:49 am 
Subject:NativeLibrary Usage
From:pzab...@poczta.onet.pl (pzab@poczta.onet.pl)
Date:Jul 27, 2007 8:57:10 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