5
I’m having trouble creating the java interface, because I can’t understand the header of the function in C.
Example Header function C:
CMOEP_API char * CALLCONV CMP_GetLastError( );
Now in java I have like this but I don’t know how to implement the methods:
public class DllFIles {
public static void main(String[] args) {
CMOEP lib = new CMOEP();
System.out.println("ERRO: " +lib.CMP_GetLastError());
}
}
class CMOEP{
static {
System.loadLibrary("CMOEP");
}
public native char[] CMP_GetLastError( );
// CMOEP_API char * CALLCONV CMP_GetLastError( );
public CMOEP(){}
}
Any ideas/help?
You can learn in this tutorial from Caelum http://blog.caelum.com.br/escrevendo-metodos-nativos-em-java-com-jni-e-jna/
– Heidy Miguel
What is the name of your . dll file? In your signature of the method in C, it seems to me that you are returning a char, and in the native call it seems that you are declared char[].
– wryel
A. dll belongs to the company and serves to access a database, so the name is not important, I am still not using it completely because I lack the data access to BD, however as I have never used a library . dll wanted to start realizing for when you have to use it to be much easier...
– jsantos1991