Home Articles Books Downloads FAQs Tips

Q: Determine which DLLs are needed by a program


Answer

Use the command line utility TDUMP.EXE that comes with C++Builder. TDUMP will list the imported modules of a program if you pass it the command line parameter "-em.". Note the trailing period. To list the imported DLLs from PROJECT1.EXE, execute this command from a DOS prompt:

tdump -em. project1.exe

The text below shows the output of TDUMP. In this example, the project was compiled with the dynamic RTL option on, but with runtime packages turned off.

C:\CBuilder4\Projects>tdump -em. project1.exe | more
Turbo Dump  Version 5.0.16.6 Copyright (c) 1988, 1999 Inprise Corporation
                   Display of File PROJECT1.EXE

IMPORT:     borlndmm.dll
IMPORT:     ADVAPI32.DLL
IMPORT:     KERNEL32.DLL
IMPORT:     COMCTL32.DLL
IMPORT:        GDI32.DLL
IMPORT:       USER32.DLL
IMPORT:        OLE32.DLL
IMPORT:     OLEAUT32.DLL
IMPORT:     cp3245mt.dll

The files borlndmm.dll and cp3245mt.dll are the dynamic RTL DLLs. When I uncheck the RTL checkbox and statically link with the runtime libraries, the output from TDUMP becomes:

C:\CBuilder4\Projects>tdump -em. project1.exe
Turbo Dump  Version 5.0.16.6 Copyright (c) 1988, 1999 Inprise Corporation
                   Display of File PROJECT1.EXE

IMPORT:     ADVAPI32.DLL
IMPORT:     KERNEL32.DLL
IMPORT:     COMCTL32.DLL
IMPORT:        GDI32.DLL
IMPORT:       USER32.DLL
IMPORT:        OLE32.DLL
IMPORT:     OLEAUT32.DLL

When I turn off the runtime libraries option, the compiled program no longer depends on borlndmm.dll and cp32345mt.dll.

Note: TDUMP can only list the DLLs that are implicitly linked to the project using an import library. TDUMP does not list DLLs that loaded with the LoadLibrary API function.



Copyright © 1997-2000 by Harold Howe.
All rights reserved.