9 messages in net.java.dev.jna.usersUnsatisfiedLinkError with
FromSent OnAttachments
Nicolas VienneDec 12, 2007 2:48 am 
Timothy WallDec 12, 2007 4:42 am 
Nicolas VienneDec 12, 2007 5:31 am 
Timothy WallDec 12, 2007 6:10 am 
Nicolas VienneDec 12, 2007 7:02 am 
Timothy WallDec 12, 2007 7:29 am 
Timothy WallDec 12, 2007 7:55 am 
Nicolas VienneDec 12, 2007 8:12 am 
Timothy WallDec 12, 2007 8:30 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:UnsatisfiedLinkError with Actions...
From:Nicolas Vienne (ikar@tagazok.net)
Date:Dec 12, 2007 2:48:20 am
List:net.java.dev.jna.users

Hello everybody,

I have a little problem while trying to use JNA with my own DLL. I defined the function : int add(int a, int b) I tried many mappings (StdCallLibrary, Library, etc ...), for instance: public interface DllFunction extends StdCallLibrary { DllFunction INSTANCE = (DllFunction)Native.loadLibrary("DllTest", DllFunction.class); public int add(int a, int b); } but every time, the call: DllFunction.INSTANCE.add(12, 30) raises an "java.lang.UnsatisfiedLinkError: Cannot locate function 'add'".

I tried also to pass an StdCallFunctionMapper but it fixed nothing.

After taking a look at the dll file with depends i found that the function was named "?add@@YAHHH@Z", and thus: NativeLibrary nl = NativeLibrary.getInstance("DllTest"); Function f = nl.getFunction("?add@@YAHHH@Z"); Object[] a = {12,30}; System.out.println(f.invokeInt( a )); works fine.

I wonder if there is a way to do it the "right" way ie with the interface mapping ?

Thank you for any help !

Nicolas