简体   繁体   中英

How to debug a DLL called from Java in 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).

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.

It works if I define the host application (Java) and set the correct arguments:

  • Host Application: C:\\Programme\\Java\\jdk1.6.0_14\\jre\\bin\\java.exe
  • Parameter: -cp "/path/to/test.jar" junit.textui.TestRunner AppTest

The JUnit text TestRunner command line arguments are explained here: http://junit.sourceforge.net/junit3.8.1/javadoc/junit/textui/TestRunner.html

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM