如何在Delphi中调试从Java调用的DLL?
我使用 Delphi 编写了一个 DLL,可以通过 JNA (Java Native Access) 从 Java 调用该 DLL。这个DLL中的方法只是简单的操作,但为了将来的使用和更复杂的调用,我想知道如果直接从Java(或从Java IDE)调用DLL,如何使用Delphi调试器。
With Delphi I wrote a DLL which can be called from Java via JNA (Java Native Access). Methods in this DLL are just simple operations, but for future use and more complex invocations I would like to know how I can use the Delphi debugger, if the DLL is called from Java directly (or from the Java IDE).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信这个问题的答案与 Stack Overflow 问题的答案相同如何在Delphi中调试DLL文件。
事实上,由于您在Delphi环境中调试Delphi的DLL文件,因此谁位于调用堆栈的较高层并不重要。
I believe the answer for this question would be the same as for Stack Overflow question How to debug a DLL file in Delphi.
In fact, since you debug the Delphi's DLL file within a Delphi environment, it does not matter who is in the higher of the call stack.
如果我定义主机应用程序(Java)并设置正确的参数,它就可以工作:
JUnit 文本 TestRunner 命令行参数解释如下:
http://junit.sourceforge.net/junit3.8.1/ javadoc/junit/textui/TestRunner.html
It works if I define the host application (Java) and set the correct arguments:
The JUnit text TestRunner command line arguments are explained here:
http://junit.sourceforge.net/junit3.8.1/javadoc/junit/textui/TestRunner.html
为什么不先在Delphi中调试DLL呢? Delphi 有一个名为 DUnit 的单元测试框架。您仍然需要为整个系统编写集成测试,但您可以在 JUnit 单元测试中模拟外部依赖项。
Why not debug the DLL in Delphi first? There's a unit testing framework for Delphi called DUnit. You'll still want to write integration tests for the full system, but you could mock out the external dependency in your JUnit unit tests.