求大神指点,怎么用JNA调用dll,出错如下:
java代码:public class WordUtils {
public interface Dll extends StdCallLibrary {
Dll INSTANCE = (Dll) Native.loadLibrary("HtmlToWordDll", Dll.class);//加载动态库文件
public int runTest(String s);//动态库中调用的方法
}
public static void main(String[] args) {
System.out.println(Dll.INSTANCE.runTest("love"));
}
c#类库代码:namespace HtmlToWordDll
{
public class Class1
{
public static void runTest(string basePath)
{
Console.WriteLine("小源很帅:" + basePath);
}
}
}
java报错信息:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'runTest': 找不到指定的程序。
at com.sun.jna.Function.<init>(Function.java:208)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
at com.sun.jna.Library$Handler.invoke(Library.java:199)
at com.sun.proxy.$Proxy0.runTest(Unknown Source)
at com.edu.utils.WordUtils.main(WordUtils.java:17)