Currently I have the DLL files (rfid.dll;cpl.dll;rfidtx.dll;) at the root of my bundle. I make a Utility Bundle to hold the jna.jar, and export com.sun.jna, com.sun.jna.ptr as services.
The Manifest for the bundle in question looks something like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ServiceImpl
Bundle-SymbolicName: osgi.mti.serviceImpl
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ZTESOFT
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: osgi.mti.service,
org.osgi.service.component;version="1.1.0",
com.sun.jna,
com.sun.jna.ptr
Service-Component: OSGI-INF/component.xml
Bundle-NativeCode: rfid.dll;cpl.dll;rfidtx.dll;
osname=WindowsXP;
processor=x86
In my code, the JNA interface is declared as:
public interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary) Native.loadLibrary("rfid",
CLibrary.class);
............
}
When I running there are some exception messages displayed. The root exception is:
java.lang.UnsatisfiedLinkError: Unable to load library 'rfid'
So, how can I solve this problem? I hope someone can help me.