Program Structure and Syntax A complete, executable Delphi application consists of multiple unit modules, all tied together by a single source code
module called a project file. In traditional Pascal programming, all source code, including the main program, is stored
in .pas files. Borland tools use the file extension .dpr to designate the main program source module, while most other
source code resides in unit files having the traditional .pas extension. To build a project, the compiler needs the
project source file, and either a source file or a compiled unit file for each unit.
Note: Strictly speaking, you need not explicitly use any units in a project, but all programs automatically use the
System
unit and the
SysInit
unit.
The source code file for an executable Delphi application contains
a program heading,
a uses clause (optional), and
a block of declarations and executable statements.
Additionally, a Delphi 2005 program may contain a namespaces clause, to specify additional namespaces in which
to search for generic units. This topic is covered in more detail in the section Using .NET Namespaces with Delphi.
The compiler, and hence the IDE, expect to find these three elements in a single project (.dpr) file.