Quick start manual

Overview
2-3
Example programs
Various tools in the IDE store data in files of other types. Desktop settings (.dsk or
.desk) files contain information about the arrangement of windows and other
configuration options; desktop settings can be project-specific or environment-wide.
These files have no direct effect on compilation.
Compiler-generated files
The first time you build an application or a dynamically linkable library, the compiler
produces a compiled unit (.dcu on Windows, and .dcu or .dpu on Linux) file for each
new unit used in your project; all the .dcu/.dpu files in your project are then linked
to create a single executable or shared library file. The first time you build a package,
the compiler produces a file for each new unit contained in the package, and then
creates both a .dcp and a package file. (For more information about libraries and
packages, see Chapter 9.) If you use the –GD switch, the linker generates a map file
and a .drc file; the .drc file, which contains string resources, can be compiled into a
resource file.
When you build a project, individual units are not recompiled unless their source
(.pas) files have changed since the last compilation, their .dcu/.dpu files cannot be
found, you explicitly tell the compiler to reprocess them, or the interface of the unit
depends on another unit which has been changed. In fact, it is not necessary for a
unit’s source file to be present at all, as long as the compiler can find the compiled
unit file and that unit has no dependencies on other units that have changed.
Example programs
The examples that follow illustrate basic features of Delphi programming. The
examples show simple applications that would not normally be compiled from the
IDE; you can compile them from the command line.
A simple console application
The program below is a simple console application that you can compile and run
from the command prompt.
program Greeting;
{$APPTYPE CONSOLE}
var MyMessage: string;
begin
MyMessage := 'Hello world!';
Writeln(MyMessage);
end.