Compiler, dcc32.exe
dcc32 [-Aunit
=alias
] [-B] [-CC] [-CG] [-Dsyms
] [-Edirectory
] [-Faddress
] [-GD] [-GP] [-GS] [-H] [-Ipaths
] [-J] [-JP] [-Kaddr
] [-LEdirectory
] [-LNdirectory
] [-LUpackage
] [-M] [-Ndirectory
] [-Opaths
] [-P] [-Q] [-Rpaths
] [-TXext
] [-Upaths
] [-V] [-VN] [-VR] [-W] [-Z] [-$A+|-] [-$B+|-] [-$C+|-] [-$D+|-] [-$G+|-] [-$H+|-] [-$I+|-] [-$J+|-] [-$L+|-] [-$M+|-|minStackSize
[,maxStackSize
]] [-$O+|-] [-$P+|-] [-$Q+|-] [-$R+|-] [-$T+|-] [-$U+|-] [-$V+|-] [-$W+|-] [-$X+|-] [-$Y+|-YD] [-$Z+|-|1|2|4]file
... [options
...]
dcc32.exe is Delphi’s command-line compiler. It uses the same compiler as the IDE, but you run the program from a command prompt. To control the compiler, you must supply options on the command line or in a configuration (.cfg ) file. The IDE automatically creates a configuration file for every project, so it is easy to compile a project or unit from the command line using the same options you use in the IDE.
You can mix options and filenames in any order on the command line. The compiler reads all the options before it starts to compile any of the files. The filenames can be any program, library, unit, or package source files. Unlike the IDE, with the command-line compiler, you can compile a single unit (.pas) source file. If a filename is that of a project, library, or package, the compiler also links the necessary units into the final .exe, .dll, or .bpl file. If you omit the extension from a source filename, Delphi tries .pas, then .dpr. To compile a package, you must supply the .dpk extension.
If you do not list any filenames on the command line, the compiler prints a brief summary of its options and usage.
The compiler gets options from four places. It checks all four sources, in order, so later sources can override earlier ones:
The global configuration file, dcc32.cfg, is in
Delphi’s bin directory. You can modify
this file to store options that apply to all projects. For example,
you might use -u
to list directories where Delphi
should look for .dcu files.
The local configuration file, dcc32.cfg, is in the current directory.
The project configuration file resides in the same directory as the project source file. Its filename is the project filename, with the .cfg extension. Note that the IDE automatically creates a .cfg file for each project, saving the project’s options in the configuration file.
You can override the options in the configuration files by specifying additional or different options on the command line. The options can precede or follow the source filename.
A configuration file can contain any number of command-line options on any number of lines. For maximum clarity, it is best to put separate options on separate lines.
Each option switch can start with a hyphen (-
) or
a slash (/
). If you use a slash, you can
concatenate options into a single command-line argument, but if you
use a hyphen, you must separate options with spaces. In either case,
you can use single-letter compiler directive switches as command-line
switches, e.g., -$A+
. Combine compiler directive
switches by separating them with commas, e.g.,
-$A+,B+,M-
. Switches are not case sensitive, so
/H
is the same as /h
.
Be careful when using directive switches with the command-line
compiler. Unlike compiler directives that are embedded in source
code, directive switches on the command line and in
.cfg files are not subject to error checking.
Any letter is allowed as a switch name, and invalid switches are
ignored. Any character is allowed after the switch letter, and most
characters mean the same as +
.
You can list any number of filenames on the command line. The compiler compiles the source files one at a time. If a source file uses other units, the compiler ensures that those units are up to date and compiles them first, if necessary.
Unlike the IDE, the command-line compiler does not compile resource
scripts listed in $R
and
$Resource
compiler directives. You must run the
resource compiler separately. (The next section covers the resource
compiler.)
The rest of this section lists all the command-line options:
-A
unit
=alias
;...
Create a unit alias so any use of unit
in
a unit’s uses
declaration is actually a
reference to alias
. This option is used
most often when a new version of a unit has a different name than an
earlier version of the unit. You can list multiple unit-alias pairs
by separating them with a semicolon, for example,
-AWinTypes=Windows;WinProcs=Windows
.
-D
sym1
;
sym2
;...
Define sym1
,
sym2
, and so on, as conditional
compilation symbols. Define multiple symbols by separating them with
a semicolon (;
). The -D
option
is equivalent to using the $Define
compiler
directive.
-E
directory
Store the output .exe or
.dll file in
directory
. The default is the current
directory.
-F
address
Find the source line that corresponds to the
address
you get from a runtime error
dialog box. If your application reports an error at an address, and
you want to locate the source of the error, rebuild the project with
the exact same options as you used earlier, but with the
-F
switch. The compiler requires debug information
(-$D+
) in order to locate the source line number.
-GD
Create a detailed .map file that lists the
segments, public symbols, and code addresses for every line number of
every unit that has debug information enabled
($DebugInfo
compiler directive). The map file is
stored in the project’s output directory (-E
or -LE
option) and has the same name as the
project, but with the .map
extension.
-GP
Create a medium-sized .map file that lists all
segments and public symbols. The map file is stored in the
project’s output directory (-E
or
-LE
option) and has the same name as the project,
but with the .map extension.
-GS
Create a small .map file that lists only the
segments, that is, the starting address and size for each
unit’s code and data segments. The map file is stored in the
project’s output directory (-E
or
-LE
option) and has the same name as the project,
but with the .map extension.
-J
Generate a C .obj file in addition to a .dcu file for each unit.
-JP
Generate a C++ .obj file in addition to a .dcu file for each unit.
-M
Make the unit files, that is, compile them only if needed.
-Q
Compile quietly and do not list filenames as they are compiled.
-TX
ext
Set the extension of the output file to
ext
. Unlike the $E
compiler directive (which works only for libraries), the
-TX
option applies to programs and libraries. If
you omit a leading dot (.
) in
ext
, the compiler automatically inserts
one. For example, -TXscr
.
-W
Generate compiler warnings ($Warnings
compiler
directive).
-$C-
-$C+
Compile assertions ($Assertions
compiler
directive). Default is -$C+
.