I am using jni4net
to use the DLL function in Java.
Using jni4net-0.8.6.0-bin I compile using the command:
.\proxygen.exe "D:\sampledlls\sample_interface.dll" -wd "D:\hope"
On executing this command , getting the following error:
System.BadImageFormatException: Could not load file or assembly 'file:///D:\sampledlls\sampledll.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I also used JNA library to use the DLL function in java. But in that as well I am getting the following error:
java.lang.UnsatisfiedLinkError: Unable to load library 'sampledll': The specified module could not be found.
Here is my code for JNA:
public class hellodll {
public interface dcmInterfaceDLL extends Library {
public void DCM_InitializeFields();
}
public static void main(String[] args) {
System.out.println(System.getProperty("java.library.path"));
System.setProperty("jna.library.path",
"C:\Users\320035705\Downloads\JNAHelloWorldMWrobel\JNAHelloWorldMWrobel\sampledlls");
dcmInterfaceDLL sdll = (dcmInterfaceDLL)
Native.loadLibrary("sample_interface", dcmInterfaceDLL.class);
System.loadLibrary("sample_interface");
sdll.DCM_InitializeFields();
}
}
This is a native.dll.
How can I load my DLL?