我是一个java新手,我试图加载一个delphi dll,并从中调用函数。在java中使用jna加载delphi dll
使用winbinder在PHP已经尝试过,但它似乎是无用的:reloading dll in winbinder (php gui) crashes program
反正我有这个简单的Java代码,我无法弄清楚如何使它发挥作用。互联网上有一些例子,但似乎没有一个适合我。
Dll是32位,所以是我的Windows,JDK和Eclipse。简单功能使用将是GetDllVersion
。我真的会赞同任何帮助。
我甚至无法加载它,这里是第一个错误(有以下几个弹出窗口):
下面是代码:
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
import com.sun.jna.*;
public class Main {
static {
try {
System.load("C:/workspace/XmlDownlaoder/xxxxxxxDLL.dll");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
//how to call functions here? - there will be many functions, and final one should generate xml in return
}
}
编辑:Native code library failed to load
- 这不显示在控制台上。
DLL将提高在异常的DllMain的。这是初始化时间。你可以从另一个环境加载它吗?例如Delphi。或者C++。 – 2013-05-11 23:09:46
忘记关于Java,直到你可以写一个C程序,将加载DLL – 2013-05-12 16:07:31
我有点期待即将到来,我需要听到(阅读)ID :)。感谢名单。我用C++试试我的运气。 – 2013-05-12 19:09:19