How can I find all the units in my Delphi app?

I use the GExperts Project Dependencies.
With the "Used By...", you can see units included but not used by anyone. But you can't see unit included in uses clauses that could be removed when they don't have any code actually called.

Here's the help:


Project Dependencies

The project dependency expert enables you to see what units a particular unit uses, and in turn what units use a particular unit. When this expert is activated, it parses all of the current project's source code for uses clauses and builds up a list of dependencies. To view the dependency information for a particular unit, click on it in the left pane. The right pane will contain the dependency information. Indirect dependencies are units that are used by used units of a particular unit.

You can refresh the dependency information at any time by clicking the refresh button on the toolbar and you can sort the file listing by clicking on the column headers.
alt text
(source: gexperts.org)


OTOH, you can also use free Peganza's ICARUS as a more detailed reporting tool but less interactive...


Have you looked at Pascal Analyzer or the free limited version, Icarus, from Peganza Software? They will create "uses reports" telling you what module uses what others, so that should give you the info you're after.

Marc


The Delphi debugger can show you which units were compiled into a module (exe, dll or package). You can see this in the Modules view (View | Debug Windows | Modules). Click on a module in the upper left pane, and the lower left pane will show all the compilation units that were built into that module. If a particular compilation unit was made up of multiple source files (i.e a .pas and a .inc file), that will be shown too (when you expand the comp unit).

Alternatively, you can have the Delphi compiler show you a list of used .dcus by passing --depends when you compile a project. It will output a .d file with a list of the .dcus (and .dcps) that were required.


Another, but rather cumbersome way, is to generate a map file, it contains a list of all units used in a program.

see also this answer: How can I find all the units in my Delphi app?