Cesar Quevedo Vega Cesar Quevedo Vega - 15 days ago 6
Java Question

call DLL library method/function from Java code

I need to call the methods that can be reached in the dll but I can not access them, here is the dll

public class JavaApplication2 {

public interface simpleDLL extends Library {
simpleDLL INSTANCE = (simpleDLL) Native.loadLibrary("HComPinpad", simpleDLL.class);
void DllUnregisterServer();
String ReadCard();
}
public static void main(String[] args) {
simpleDLL sdll = simpleDLL.INSTANCE;
sdll.ReadCard();
}
}


Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'ReadCard': No se encontrĂ³ el proceso especificado.

Here is the DLL information:

DLL information

Answer

I don't know much about the communication between Java and .dll files, but shortly I also had to call some dll functions and I have been advised to use com4j, because its just easy to use. I really don't know why your example is not working, but you might wonna have a look at com4j as well.

This way you can avoid annoying typos and be sure, you get all methods supported from that specific .dll.

There is a com4j tutorial, which describes how to use com4j with .ocx files, but it workes same way for .dll files as well.