Borland produced Delphi, has a lightning-like compiler speed, but in the interface control use more, the project is larger, compiling a project still need a period of time, open the huge Delphi IDE, also need time.
In fact, at the end of a project development, debug after the release of the compilation, can be used to execute the command line, because the Delphi compiler parameters are not as complex as C + + compiler.
The author of the Delphi Online manual on the command line compiler (command-line compiler) several topics translated, I hope that the Delphi developers help. Directory 1. command-line compiler command line compiler 2. command-line compiler Options command line compiler option 3. Compiler Directive options compiler directive Option 4. Compiler mode options compile pattern option 5. DCC32. The CFG file compiler configuration file Dcc32.cfg 6. Debug Options Debug Option 7. Directory options directory option 8. IDE command-line Options IDE command line option 9. Generated files several IDE automatically generated file introduction command-line compiler command line compiler Delphi ' s command-line compiler (DCC32. EXE) lets you invoke the functions of the IDE compiler (DELPHI32. EXE) from the DOS command line (the IDE command-line options.) Run the command-line compiler from the DOS prompt using the Syntax:delphi ' s command line compiler (Dcc32.exe) allows you to implement from DOS command-line (reference: IDE command-line options) All the features of the IDE compiler (Delphi32.exe). Run the command line compiler with the DOS command The syntax is as follows: DCC32 [options] filename [options] dcc32 [option] [filename] [options] where options are ZEro or more parameters this provide information to the compiler and the name of the source file to compile.
If you are type DCC32 alone, it displays a help screen of command-line options and syntax. 0 or more parameters provide information to the compiler that specifies the source file name to compile.
If you enter DCC32 separately, it displays a screen of options and syntax for command-line compilation. If filename does not have a extension, the command-line compiler assumes. DPR, then. PAS, if no. DPR is found.
If the file you ' re compiling to doesn ' t have a extension, you must append a period (.) to the "end of" the filename. If the file name does not have an extension, the command-line compiler looks for a file with the same name with the extension. DPR, and if it cannot, look for a file with the same name with the. pas extension.
If your source file does not have an extension, you need to add (.) to the end of the file name. If the source text contained in filename be a program, the compiler creates a executable file named filename. Exe. If filename contains a library, the compiler creates a file named filename. DLL. If filename contains a package, the compiler creates a file named filename. BPL.
If filename contains a, the compiler creates a unit file named FILENAME.DCU. If the specified source file is a project file, the compiler creates an extension of. EXE with the same name as the executable file. Such asThe source file specified is a library file, and the compiler creates an extension named. DLL with the same name as the dynamic link library file. If the specified source file is a package file, the compiler creates an extension of. BPL package with the same name.
If the specified source file is a cell file, the compiler creates a target code file with a. dcu extension. Can specify a number of options for the command-line compiler. An option consists of the A slash (/) or immediately followed by IS option letter. In some cases, the option was followed by additional information, such as a number, a symbol, or a directory name.
The Options can is given in any order and can come before or after the file name. You can specify multiple parameters for the command-line compiler. A parameter consists of a dash "-" (or "/") and an option character that follows. Typically, an option character is followed by additional information, such as a number, a symbol, a directory, and so on.
Options can be in any order and can be in front of or behind the source file name. command-line compiler Options command line compilation option The IDE lets you to set various options through the menus; The command-line compiler gives you in access to these options using the slash (/) delimiter. You can also precede the options with a hyphen (-) instead of a slash (/), but those options so start with a hyphen must is separated by blanks. For example, the following two command lines are equivalent and legal:ide allows you to use the menu to set theCompilation options, and the command-line compiler allows you to use the character "/" as the delimiter to set these compilation options. You can also use the hyphen "-" instead of "/", but the arguments drawn with "-" must be separated by a space. For example, the following two commands are both equivalent and legal: Dcc-ic:\delphi-ddebug sortname-$R--$U + dcc/ic:\delphi/ddebug sortname/$R-/$U + the first C Ommand line uses hyphens and at least one blank options.
The second uses slashes and no separation is needed. The first compilation command uses "-" to draw out the parameters, and there are multiple spaces separated between the parameters.
The second compilation command uses "/" to draw out parameters that are not necessarily delimited between parameters. The following table lists the command-line options. In addition to the listed options, all Single-letter compiler directives can is specified on the command line, as describe
D in Compiler Directive options. All command-line arguments are listed in the following table.
In the attached list of options, all single character compiler directives can be used in command line compilation, for more information, refer to: Compiler directives. Option Description Options Description Aunit=alias Set cell alias B compile all cells CC compiler console program CG compile graphical interface program ddefines compile conditional symbol definition Epath Executable Output path Foffset lookup Run error GD build complete. Map file GP generation. Map file public segment GS generation. Map file Segment Section H output hint information ipaths file contains path J build. Obj target file JP generates C + + types. Obj target file kaddress Set image Base Address Lepath package. bpl File Output Path Lnpath The. dcp file output path Lupackage uses the runtime package list M to compile a modified source file Npath dcu/dpu file output directory opaths. OBJ file (assembly target code file) path P finds Q Quiet mode rpaths resource file (. RES) path Txext the target file extension upaths cell file path V generates a debug information file for Turbo Debugger VN the. Giant format to generate debug information files containing namespaces (to be used for C++builder) VR Generates debug information files. RSM W output warning Information Z Disable Implicit compilation $directive Compiler directives--help shows help for compilation options.
Similarly, if you enter DCC32 separately on the command line, the Help for the compile option is also displayed. --version Display product name and version Compiler Directive options compiler Directive option Delphi supports the Compiler directives described in Compiler D Irectives. The $ and D command-line options allow you to change the default states of most compiler directives. Using $ and D on the command line are equivalent to inserting the corresponding compiler directive in the beginning of each
source file compiled. Delphi supports compiler directives described with compiler directive keywords. Use the "$" and "D" command-line options to change all default compiler states.
Using the "$" and "D" command-line options is equivalent to adding a compiler directive before the source file. Switch directive option compiler directive options switch the $ option lets you to change the "default" of all of the switch DirecTives. The syntax of a switch directive option is $ followed by the directive letter and followed by a plus (+) or a minus (-). For example: "$" allows you to change the default state of each compiler directive. The syntax of the compiler instruction is "$" followed by a command character, followed by a "-" or "+". For example: Dcc32 mystuff-$R-compiles mystuff.pas with range-checking-off, while: Compile turned unit without boundary check: Mystuff.pas M ystuff-$R + compiles it with range checking turned on.
Note this if a {$R +} or {$R-} compiler directive appears in the source text, it overrides the-$R command-line option. Use the interface check to compile the Mystuff.pas unit.
If you add the compiler directive {$R +} or {$R-} to the beginning of the source file, it overrides the arguments passed in from the command line. You can repeat the-$ option in order to specify multiple compiler directives: you may use multiple "$" to specify multiple compiler directives, such as: Dcc32 MyStuff-$ r--$I--$V--$U + Alternately, the command-line compiler lets you to write a list of directives (except for $M), separated by
Commas: The command-line compiler allows a comma-delimited compiler to specify a list, such as: Dcc32 mystuff-$R-,i-,v-,u+ only need a "$" symbol.
Only one dollar sign ($) is needed. Notice that because the $m format is not the same, you cannot use $m Note that in a comma-delimited list of instructions, because of its format, Cannot use the $M directive in a list of directives separated by commas. Conditional defines option conditional compilation options the-d option lets you define Conditional and symbols to the {$DEFINE corresponding BOL} compiler directive. the-d option must be followed by one or more conditional symbols separated by semicolons (;). For example, the following command line: the "-d" option allows you to define a compilation condition that conforms to the compiler directive that you define with {$DEFINE symbol}. The "-d" option must follow one or more symbols for compiling conditions separated by semicolons, such as the following command: DCC32 mystuff-diocheck;debug; List defines three conditional symbols, Iocheck, debug, and List, for the compilation of Mystuff.pas. This is equivalent to inserting: Defines three compilation condition symbols: iocheck,debug,list, for mystuff.pas cells. This equates to inserting the following statement in the source file: {$DEFINE Iocheck} {$DEFINE DEBUG} {$DEFINE LIST} at the beginning of Mystuff.pas. If you are specify multiple-d directives, you can concatenate the symbol lists.
Therefore: If you specify multiple "-D" options, you can join them as follows: Dcc32 mystuff-diocheck-ddebug-dlist is equivalent to the "the" "the".
Equivalent to the first example. Compiler Mode Options CompilationMode option A Few options affect how the compiler itself functions. As with the "other options", can use this with either the hyphen or the slash format.
Remember to separate the options with at least one blank. There are several options that can affect the functionality of the compiler itself. Like other options, you can use the format "/" or "-".
Don't forget to separate these options with at least one space. Make (m) option (m) the command-line compiler has built-in make logic to aid in project maintenance. THE-M option instructs command-line compiler to check all units upon the which the file being compiled.
Using This option results in a much quicker compile time. The command-line compiler uses the method of constructing logic to maintain the project. The "-M" option instructs the compiler to check all files associated with the compiled file.
Using this parameter will cause the compilation time to increase. A is recompiled under the following conditions: A source file will be recompiled in the following situations: "Source file for" unit has been
Since the unit file is created. The source file has been modified since it was created, and any file contained in the "$I" instruction is contained in "$L". obj file, or any resource file associated with "$R". Res, which is newer than the source file, any file included with the $I directive, any. OBJ file linked the $L directive, or any. res file referenced by the $R directive, is newerthan the unit file.
The interface section-a unit referenced in a uses statement has changed.
The uses section of the interface section of the cell interface is changed.
Units compiled with THE-Z option are excluded to make logic.
Instruction "-Z" at unit compile time is not accepted in the construction logic period. If you were applying this option to the previous example, the command would is: If you use this instruction in the previous example, the compile command should be: DCC32 Mystu Ff-m Build All (b) option compiles all options (-B) Instead of relying on the-m option to determine what needs to be updated, Y ou can tell command-line compiler to update all units upon which your program depends using The-b option. You can ' t use-m and-b in the same time.
The-b option is slower than the-m option and is usually unnecessary. To replace the option to know which cells need to update-m, you can use the-B option to update all the associated units in your program. You cannot use both-m and-B in the program.
Option-B is slower than-m, and it is not required. If you were use this option in the previous example, the command would is if you used this parameter in the previous example, the compiler command should be: DCC32 MyStuff- B Find error (-f) Option finds error option (-f) When a program terminates due to a runtime error, it dispLays an error code and the "Address" at which the error occurred. By specifying so address in a-faddress option, you can locate the statement in the source text of that caused the error, p
Rovided your program and units were compiled with debug information enabled (via the $D compiler Directive). When a program terminates because of a run-time error, it displays an error number and an error address when the error occurs.
Using the-faddress option to specify the error address, you can find the location where the error was raised in the source file, if your program and unit were compiled with debug information (using the $d compiler Directive). In order for the command-line compiler of the runtime error with-f, you must compile the "program" with all same C
Ommand-line parameters you used the ' the ' the ' the ' in compiled it.
In order for the command-line compiler to find run-time errors with the-f option, you must pass the same list of instructions as the first compilation. As mentioned previously, you must compile your program and units with debug information enabled for the command-line Compi Ler to is able to find runtime errors. By default, all programs and units are compiled with debug information enabled, but if to turn it off, using a {$D-} comp Iler directive or a-$D-option, the command-line compiler won't be ableto locate runtime errors. As mentioned earlier, your programs and units must have debugging information enabled for the command-line compiler to find run-time errors.
By default, all programs and orders are enabled for debugging, unless you close it with the {-d} or-$D-directive so that the command-line compiler cannot find run-time errors. Use Packages (-LU) option uses the package (-LU) options using The-lu option to a list additional runtime packages that your want to usage in th e application being compiled.
Runtime packages already listed in the Project Options dialog box need is not being repeated on the command line. Use the-LU option to add runtime packages to be used in your application at compile time.
The run period package is already listed in the Project Options dialog box and is no longer added to the command line. Disable implicit compilation (-Z) option (this option has a different description in delphi6.0/7.0, not translated here) the-z option prevents packages and units fr Om being implicitly recompiled later. With packages, it's equivalent to placing {$ implicitbuild out} in the. dpk file. Use-z When compiling packages this provide low-level functionality, that change infrequently between, or builds whose
RCE code won't be distributed. Target file extension (-TX) option destination filename extension (-TX) Options the-tx-option lets you override the default extension for the OUTPU T file. For ExampLe, option-tx allows you to overwrite the default output file name extension. For example: DCC32 Mystuff-txsys generates compiled output in a file called MyStuff.
SYS.
The generated will be a file called Mystuff.sys. Quiet (q) Option Quiet mode (-Q) Options The Quiet mode option suppresses the printing of file names and line numbers during Lation.
When the command-line compiler was invoked with the quiet mode option suppresses the file name and line count at compile time if the command-line compiler invokes this option. DCC32 mystuff-q its output are limited to the startup copyright and the usual statistics in the end of Compilatio
N. If any errors occur, they would be reported. Its output is limited to the start of the copyright information and the end of the statistic information.
Of course, if an error occurs, it will also output. DCC32. CFG file DCC32. CFG configuration file can be set up a list of options in a configuration file called DCC32. CFG, which'll then be used in addition to the options entered on the command line. Each line in configuration file corresponds to a extra command-line argument inserted before the actual command-line ments. Thus, by creating a configuration file, your can change the default setting an any COMmand-line option. You can set up a list of compiled options to a configuration file called Dcc32.cfg, which will be used when the compile-time is appended to the command line arguments. Each row of the configuration file is equivalent to an extra command-line argument inserted before the actual command line parameter (note that it is before the actual argument).
As a result, you can use this configuration file to change the default settings for some command line parameters. The command-line compiler lets you to enter the same command-line option several times, ignoring all but the last occurrence. This way, even though your ' ve changed some settings with a configuration file, your can still override on the command
Line. The command-line compiler allows you to enter the same command-line arguments, and it ignores all but the last one.
This way, although through the configuration file you can change some settings, you can still override it using command-line arguments. When Dcc32 starts, the it looks for DCC32. CFG in the current directory. If the file isn ' t found there, DCC32 looks in the directory where DCC32.
EXE resides. When DCC32 starts, it looks for the dcc32.cfg file in the current directory.
If the file is not found, Dcc32 finds the directory in which it resides. Here's an example DCC32. CFG file, defining some default directories for include, object, and unit files, and changing the default states of the $O
and $R compiler directives: The following is an example of a dcc32.cfg configuration file that defines the default values for file inclusion, obj file inclusion, Unit file search path information, and changes to compiler directives $o and ". -ic:\delphi\inc; C:\delphi\src-oc:\delphi\asm-uc:\delphi\units-$R +-$O-now, if you type: Now, if you enter: Dcc32 mystuff The compiler performs as if you had typed the fol lowing: The compiler treats it as you enter the following command: Dcc32-ic:\delphi\inc; c:\delphi\src-oc:\delphi\asm-uc:\delphi\units-$R +-$O-mystuff debug Options Debug option The compiler has two sets of comma Nd-line options that enable your to generate external debugging information:the map file options and the Debug Info option
S. Compilers have two command-line arguments to generate external debugging information: Map file options and debug information options. The map file (g) options Map file (g) Option the-g option instructs the command-line compiler to generate a. map files that shows The layout of the executable file. Unlike the binary format of executable and. dcu files, a. Map file is a legible text file this can be output on a printer or loaded into the editor. THE-G option must is followed by the "Letter S, P, or D to indicate" desired level of information in the. map file. A. MAP file is divided into three sections: Option-G instructs the command-line compiler to generate a. map file to view the layout of an executable file. Unlike binary executable files and. dcu files, the. map file is aA read text file that can be printed or edited by another text editor. Option-G must be followed by the character S, p, or D to determine the information you want to list in the. map file. One. The map file is divided into three sections: Segment publics line numbers-gs outputs only the Segment section,-GP outputs the Segment and public s section, AND-GD outputs all three sections. -GD also generates a.
DRC file that contains tables of all string constants declared using the Resourcestring keyword. The-GS option outputs only the Segment Section,-gs option output segment and publics,-
GD output all three SECTIONS.-GD options also generates a file with a. DRC extension containing all the string constants declared with the Resourcestring keyword. For modules (program and units) compiled in the {$D +,l+} state (the default), the publics section shows all global variabl ES, procedures, and functions, and the line Numbers section shows line Numbers to all procedures and functions in the MoD Ule. In the {$D +,l-} state, only symbols defined in a unit's interface part are listed on the publics section.
For modules compiled in the {$D-} state, there are no entries on the Line Numbers section. Compile the module (program or unit) with the default compilation option {$D +,l+}, publics section enumerates all global variables, procedures, and functions, line Numbers section enumerates the line numbers of all the procedures and functions in the module. If you compile the options with {$D +,l-} compile the module, publics section enumerates only the symbols defined in the interface portion of the unit.
If you compile the module with the {$D-} option, there is no entry in line Numbers section. Debug Info (-V) Options dispatch option (-V) the-v options (-V,-vn. And-vr), which cause the compiler to generate debug Informa
tion, can is combined on the command line.
Options-V,-VN,-VR instruct the compiler to generate debugging information that can be combined in the command line. Generate Turbo Debugger Debug Info (-V) option generates the debug information used by Turbo Debugger (-V) When your specify THE-V option on the CO Mmand Line, the compiler appends Turbo Debugger 5.0-compatible external debug information in the end of the executable fil
E. Turbo Debugger includes both Source-and Machine-level debugging and powerful breakpoints. When you use the-V option at the command line, the compiler attaches external debugging information consistent with the turbo Debugger5.0 at the end of the executable file.
Turbo Debugger contains powerful breakpoints for code and hardware levels. Even though the debug information generated by-v makes the resulting executable file larger, it does not affect the Actua
L code in the executable, and does not require additional memory to run the program. Although attaching debug information to the search execution file will make the executable file grow,It does not affect executable code in the actual executable file, nor does it require additional memory to start the program. The extent of debug information appended to the executable file depends on the setting of the $D and $L compiler directive s in each of the modules and units. For modules compiled in the {$D +,l+} state, which are the default, all constant, variable, type, procedure, and function sy Mbols are known to the debugger. In the {$D +,l-} state, only symbols defined in a unit ' s interface section are known to the debugger. In the {$D-} state, no Line-number records are generated, so the debugger cannot display source lines whe