6

I have a set of compiled Delphi dcu files, without source. Is there a way to determine what types are defined inside that dcu?

JosephStyons
  • 57,317
  • 63
  • 160
  • 234

3 Answers3

9

To find out what's in a unit named FooUnit, type the following in your editor:

unit Test;

interface

uses FooUnit;

var
  x: FooUnit.

Press Ctrl+Space at the end, and the IDE will present a list of possible completion values, which should consist primarily, if not exclusively, of type names.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • 1
    Simplest solution, and it works well. I accepted schnaader's though, since it actually breaks apart the DCU directly, rather than relying on the IDE. – JosephStyons Apr 22 '09 at 19:57
7

You could have a look at DCU32INT, a Delphi DCU decompiler. It generates an .int file that is somehow readable but not compilable, but if you only want to determine the types defined, this could be enough.

schnaader
  • 49,103
  • 10
  • 104
  • 136
2

The DCU format is undocumented, last I checked. However, there is a tool I found that might give you some basic info called DCUtoPAS. It's not very well rated on the site, but it might at least extract the types for you. There is also DCU32INT, which might help as well.

Otherwise, you might just have to open the file with a hex editor and dig around for strings.

Tim Sullivan
  • 16,808
  • 11
  • 74
  • 120