5 messages in net.java.dev.jna.usersRe: [jna-users] JNA: java.lang.Unsat...
FromSent OnAttachments
SriOct 16, 2007 11:44 am 
Timothy WallOct 16, 2007 11:58 am 
Albert StrasheimOct 16, 2007 1:09 pm 
Glick, Gene (GE Indust, Security)Oct 16, 2007 1:31 pm 
SriOct 16, 2007 3:07 pm 
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:Re: [jna-users] JNA: java.lang.UnsatisfiedLinkError: Cannot locate function 'GetTimings'Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Oct 16, 2007 11:58:51 am
List:net.java.dev.jna.users

On Oct 16, 2007, at 2:45 PM, Sri wrote:

I am quite sure about the function name being 'GetTimings' coz I used StdCallFunctionMapper of JNA to get the native method name. The .dll is getting loaded fine, but it complains about function not being in the .dll .

Dump the symbols from the DLL and then you'll be sure. "nm", "objdump" work on linux, I don't recall offhand what you'd use for windows.

native method signature:

------------------------ public int GetTimings(string timings, byte[] intem, out int outTemp);

That's not a "C" interface. Assuming that's a C++ stl "string", JNA can't create one; it'll only convert java.lang.String to "const char*". The "out" usually means that the function expects a pointer to the given type.

If that's C++ or C#, the function's name is going to be mangled unless you declare it as 'extern "C"'.

method signature in my interface which extends Library com.sun.jna.Library

----------------------------------------------------------------------

---- public int GetTimings(String timings, byte[] intem, int outTemp);

Your library should derive from StdCallLibrary if that is the calling convention your library uses.