I need to call the dll method, and I do not have the source code from the dll, I read about JNI and realized that you must have a source to enter the JNI library in the code (.h).
My second shot is JNA, but I get the same error, although you do not need to change anything in the DLL.
I created two classes for testing:
interface:
package icom; import com.sun.jna.Library; public interface IConectorT extends Library { int StartConector(byte[] conectorStatus, String icomPath); }
DLL method call:
package icom; import com.sun.jna.Native; public class ConectorTJna { public static void main(String args[]) { IConectorT lib = (IConectorT) Native.loadLibrary("ConectorT", IConectorT.class); int teste = lib.StartConector(null, "C:\\ICOM"); System.out.println("RESULT: " + teste); } }
When I call the lib.StartConector method, I get the following:
Exception in the thread "main" java.lang.UnsatisfiedLinkError: Error the search function "StartConector": the specified procedure could not be found. in com.sun.jna.Function. (Function.java:179) at com.sun.jna.NativeLibrary.getFunction (NativeLibrary.java{50) at com.sun.jna.NativeLibrary.getFunction (NativeLibrary.java data30) at com.sun.jna.Library $ Handler.invoke (Library.java:203) in $ Proxy0.StartConector (Unknown source) in icom.ConectorTJna.main (ConectorTJna.java:10)
source share