I have a dll that is written in C. I have to implement the code that will use this dll in Java, but I don't quite understand the meaning of the given h file.
typedef void* wqctl_handle;
wqctl_handle _stdcall wqctl_connect (const char* SettFile, const char* SettSec, const char* name, const char* pwd);
What is this wqctl_handle return type applicable to Java and how to work with it correctly? (I understand that I should use JNA, but my experience is not enough to understand this)
I managed to implement something like this:
public interface Qmonitor extends StdCallLibrary {
Qmonitor INSTANCE = (Qmonitor) Native.load(new File("").getAbsolutePath() + "\\ClientAPI.dll", Qmonitor.class);
int wqctl_connect(String settFile, String settSec, String name, String pwd);
}
According to the documentation, this method should return either a connection descriptor or 0. But I get an error:
java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokeInt(Native Method)