StdCallLibrary is only for windows dlls that use the stdcall calling
convention. One way to define a single interface that works on both
linux and windows follows:
public interface MyLibrary implements Library {
interface MyLibraryW32 extends MyLibrary implements
StdCallLibrary { }
MyLibrary INSTANCE = (MyLibrary)Native.loadLibrary("myLibrary",
Platform.isWindows() ? MyLibraryW32.class : MyLibrary.class);
}
Use "nm" or some other symbol dumper to see what symbols are actually
defined in your library.
It's also possible that your C header is defining macros which convert
the function names into a different symbol.
On Aug 13, 2008, at 1:36 PM, Benjamin BOUCHER wrote:
Hi,
I am currently working on a project using a C library through JNA, it
works fine under Windows, but not under linux.
When I try to call a function from my JNA lib , I get the following
error message :
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError:
Error looking up function 'NexusInitialize': /usr/lib/libnexusSDK.so:
undefined symbol: NexusInitialize
I get the same result with all functions, yet I am sure that those
functions are in the .so because I can use its in C.
My interface declaration :
public interface LibNexus extends StdCallLibrary {
LibNexus INSTANCE = (LibNexus) Native.loadLibrary("nexusSDK",
LibNexus.class);
LibNexus SYNC_INSTANCE = (LibNexus)
Native.synchronizedLibrary(INSTANCE);
short NexusInitialize();
I tried with
public interface LibNexus extends Library
but got the same result.
Need help :>