你那个调用的是原生dll,C#的dll调用方法不同,具体看这里:https://www.cnblogs.com/wyongbo/p/jnaTest.html
java JNA调用dll出错,求大神指点怎么调用?
20求大神指点,怎么用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)
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答
1条回答
为你推荐
- java JNA调用dll出错,求大神指点怎么调用?
- dll
- java
- 1个回答
- JNA 调用fortran编写的Dll 问题
- dll
- java
- fortran
- 1个回答
- jna传递指针转换为数组问题
- jna
- java
- c++
- 指针
- 3个回答