0

I'm trying to locate which unit in my app uses a specific .dcu . As i don't know which unit is, i've renamed the dcu to generate an exception in compiler-time :

[DCC Error] F1026 - File not found 'IdThread.dcu'

Is there a way to locate in my project the unit using this file ? I know it's an Indy related unit, but in my project i don't have ANY Indy components !

Gerry Coll
  • 5,867
  • 1
  • 27
  • 36
delphirules
  • 6,443
  • 17
  • 59
  • 108

1 Answers1

0

As a last resort, you can use a grep-like tool to search within the DCUs themselves: e.g. Using the build in windows findstr command:

findstr /ism "\<idthread\>" *.dcu

ObscureUnit.dcu
IdScheduler.dcu

will list any DCUs with a reference to IdThread. You may need to check in the library path as well as a unit you only have in compiled format may have a reference.

Of course, IdThread may be used in a unit that is used by another unit that your project uses. You may need to perform this operation recursively.

NOTE: This may not work on a Unicode version of Delphi, as findstr doesn't support Unicode, and I'm not sure if the reference in the dcu uses Unicode. If it does, use a Unicode enabled version of grep, or use the SysInternals Strings utility to extract the "readable" text from the dcu files.

Gerry Coll
  • 5,867
  • 1
  • 27
  • 36