Delphi programs (strictly speaking, BDS 2006 programs) are composed of many different types of files.
An item in the list that has a nested item participates in a source-to-product
relationship, so a Unit
contains source code and is compiled to a CompiledUnit
,
which contains the corresponding binary code.
DelphiProjectGroup (.bdsgroup)
- a grouping of DelphiProject
sDelphiProject (.bdsproj)
- a project definition, points to one of
Program
/Library
/Package
DelphiCompilerFlags (.cfg)
- contains the flags passed to DCC32.EXE
Program (.dpr)
- a program entry point for an executable program
CompiledProgram (.exe)
Library (.dpr)
- a program entry point for a dynamically linked library
CompiledLibrary (.dll)
Package (.dpk)
- a program entry point for a special library
CompiledPackage (.bpl, .dcp)
CompiledControlPanel (.cpl)
CompiledActiveXControl (.ocx)
Unit (.pas)
- a source code module
CompiledUnit (.dcu)
Form (.dfm)
- contains the definition of a gui formResource (.res, .*)
- a binary resource (not code), like the program iconFileInclude (.inc)
- source code snippet included into the current fileBinaryObject (.obj)
- binary code that can be linked into a Delphi programThe full definition is found in delpy/model.py
.
The source code of a Delphi program is composed of:
Program
(alternatively, a Library
or Package
)Unit
sForm
sResource
sBinaryObject
s (less common)The Program
file contains the source code executed immediately upon running
the program, and Unit
s contain additional source code.
To compile a program, then, we need to:
Unit
s (written to disk as intermediate CompiledUnit
files),Program
file, andForm
s, Resource
s and
BinaryObject
s into a CompiledProgram
.However, in all but trivial cases there is also a DelphiProject
file, which contains crucial metadata used in compilation, such as:
DelphiCompilerFlags
)CompiledProgram
, where to
output the CompiledUnit
s etc.A program graph is a graph that contains all the sources
(whether source code, or binary files like Resource
s) of a program.
The root of the graph is either the program entry point (Program
/Library
/Package
),
which refers to Unit
s (which in turn refer to more Unit
s and so on) or a
DelphiProject
(if present).
Here we see the graph of a simple program. The program has one form
(Gui.dfm
), one resource file (PriceCheck.res
) and six Unit
s.
The arrows represent a dependency relationship, so in order to compile
SocketMarshall.pas
you first need to compile SocketTypes.pas
.