Delphi Command-Line Compiler

xiaoxiao2021-03-06  40

Defproj.cfg__ default configuration Which compiled by all all projects

Defproj.dof__default configuration of all projects.

Delphi Command-Line Compilerthe Command-Line Compiler Lets You Invoke All The Functions of The Ide Compiler from The Command Line. Run The Command-line Compiler from The Command Line Prompt Using The Syntax:

DCC32 [Options] filename [options]

.

To Display a Help Screen of Command-Line Options and Syntax:

DCC32

Borland Delphi Version 15.0

Copyright (c) 1983, 2002 Borland Software Corporation

SYNTAX: DCC32 [options] filename [options]

-A = = set unit alias -lu = use package

-B = build all units -m = make modified units

-Cc = console target -n = DCU Output Directory

-Cg = gui target-o = Object Directories

-D = define conditionals -p = Look for 8.3 file names als

-E = exe output directory -q = quiet compile

-F = find error -r = resource directories

-Gd = detailed map file -u = unit Directories

-Gp = map file with publics -v = debug information in EXE

-Gs = map file with segments -vr = generate remote debug (RSM

-H = Output hint messages -w = Output Warning Messages

-I = include Directories -z = Output 'Never Build' DCPS

-J = generate .obj file - $ = compiler Directive-jp = generate C .obj file --help = show this Help Screen

-K = set image base addr --version = show name and vERSIO

Compiler Switches: - $ (Defaults Are Shown Below)

A8 Aligned Record Fields P Open String Params

B- Full Boolean Evaluation Q- Integer Overflow Checking

C Evaluate Assertions At Runtime R- Range Checking

D Debug Information T- Typed @ Operator

G Use Imported Data References U-Pentium (TM) -safe Divide

H Use long strings by Default V Strict Var-strings

I I / O Checking W- Generate Stack Frames

J-Writeable Structured Consts X Extended Syntax

L Local Debug Symbols Y Symbol Reference Info

M- Runtime Type Info Z1 Minimum Size of Enum Types

O Optimization

If FileName Does Not Have An Extension, The Command-Line Compiler Assums .dpr, Then .pas, if No .dpr is found. If the file you're compiling to doesn't Have an extension, you must append a period. .

If the source text contained in filename is a program, the compiler creates an 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 Unit, The Compiler Creates a Unit File Named FileName.dcu.

You can specify a number of options for the command-line compiler An option consists of a slash (/) or hyphen. (-) immediately followed by an option letter In some cases, the option letter is followed by additional information, such as. a number, a symbol, or a directory name. Options can be given in any order and can come before or after the file name.cfg FILEYou can set up a list of options in a configuration file called DCC32.CFG, which will then be used in addition to the options entered on the command line. Each line in configuration file corresponds to an extra command-line argument inserted before the actual command-line arguments. Thus, by creating a configuration file, you can change the default setting of any Command-line Option.

The command-line compiler lets you enter the same command-line option several times, ignoring all but the last occurrence. This way, even though you've changed some settings with a configuration file, you can still override them on the command line.

.

Here's An Example Dcc32.cfg file, defining Some Default Directories for include, Object, And Unit Files, and Changing The Default State of The $ O and $ R Compiler Directives:

-IC: / Delphi / Inc; C: / Delphi / SRC

-Oc: / Delphi / ASM

-Uc: / delphi / units

$ R

$ O-

Now, if you type: DCC32 MySTUFF

The Compiler Performs as if you had typed the folload:

DCC32 -IC: / Delphi / Inc; C: / Delphi / Src -oc: / Delphi / ASM-EC: / DELPHI / Units - $ R - $ O- Mystuff

Delphi Compiler Optionsdelphi Compiler Options Correspond to Switch Directives That You Can Also Set Directly in your program code.

Selecting an option is equivalent to setting the switch directive to its posTIVE ( ) state.code generation effect

Optimization Enables Compiler Optimizations. Corresponds to {$ O}.

Stack frames forces compiler to generate stack frames on all procedures and functions. Corresponds to {$ w}.

Pentium-Safe FDIV Delphi Only. Generates Delphi Code That Detects a faulty floating-point division instruction. Corresponds to {$ u}.

Record field alignment Aligns elements in structures to the specified number of bytes (1, 2, 4, or 8) Choose the alignment type from the drop-down list Corresponds to {$ A} Note:... In older versions of Delphi, . c. c.

Runtime ErrorS Effect

Range Checking Checks That Array and String Subscripts Are Withnin Bounds. Corresponds to {$ R}.

I / O Checking Checks for I / O Errors After Every I / O Call. CORRESPONDS TO {$ I}.

Overflow Checking Checks overflow for integer Operations. Corresponds to {$}.

SYNTAX OPTIONS EFFECT

Strict var-strings sets up string parameter error checking. Corresponds to {$ V}. (If The Open parameters option is success, this option is not applicable.)

Complete Boolean Eval Evaluates Every Piece of An Expression In Boolean Terms, Regardless Of WHENER THE RESULT OF An Operand Evaluates As False. Corresponds To {$ B}.

Extended syntax enables you to define a function call as a procedure and to ignore the function result. Also enables pchar support. Corresponds to {$ x}.

Type @ operator controls the Type of pointer returned by the @ Operator. Corresponds to {$ t}.

Open parameters Enables open string parameters in procedure and function declarations. Corresponds to {$ P}. Open parameters are generally safer, and more efficient.Huge strings Enables new garbage collected strings. The string keyword corresponds to the AnsiString type with this option enabled. Otherwise The String Keyword Corresponds To The Shortstring Type. Corresponds To {$ H}.

Assignable Typed Constants Enable this for backward compatibility. When Enabled, The Compiler Allows assignments to type {$ j}.

Debugging Effect

Debug Information Puts Debug Information INTO The Unit (.dcu Or .dpu) File. Corresponds to {$ D}.

Local symbols generates local symbol information. Corresponds to {$ l} ..

Reference info / Definitions only Generates symbol reference information used by the Code Browser, Code Explorer, and Project Browser. Corresponds to {$ Y}. If Reference Info and Definitions Only are both checked ({$ YD}), the compiler records information about where identifiers are defined. If Reference Info is checked but Definitions Only is unchecked ({$ Y }), the compiler records information about where each identifier is defined and where it is used. These options have no effect unless Debug Information and Local Symbols ( SEE ABOVE).

Assertions Generates code for assertions placed in code. Corresponds to {$ C} .. Unlike exceptions, assertions can be removed for the final build. After disabling the option, rebuild the code base to eliminate assertions.

Use Debug DCUs Allows you to link in debug versions of CLX The Debug DCUs contain debug information and are built with stack frames When this option is checked, the compliler prepends the Debug DCU path (specified in Tools |.. Debugger Options on the General page ) to the unit search path specified in project | Options on the directories / conditionals page.default Check Boxdefault CHECK BOX SAVES The Current Settings as The Default for Each New Project.

Compiler mode optionsA few options affect how the compiler itself functions. As with the other options, you can use these with either the hyphen or the slash format. Remember to separate the options with at least one blank.

Note: Command line compiling without an explicit make (-M) or build (-B) switch performs an in-memory compile (make) and link, without flushing anything to disk except the specified compilation unit (unit, program, library, or Package).

For example:

DCC

Will Create a Binary Reperesenatation Only for the specified file; Any Used Units Will Not get Their DCU OR DPU Files Written To Disk.

Make (-M) Option

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 which the file being compiled depends. Using this option results in a much quicker compile time.

A Unit is Recompiled Under The Following Conditions:

The Source File For That Unit Has Been Modified Since The Unit File Was Created.

Any File Included with the $ I DIRECTIVE, Any .obj File Linked in by The $ L DIRECTIVE, or Any .res File Reference by The $ R DIRECTIVE, IS NEWER THAN THE Unit File.

The Interface Section of a Unit Reference In A Uses Statement Has Changed.

Units compiled with the the make logic.if you think of applying this option to the previous example, The Command Would Be:

DCC32 MySTUFF -M

Build all (-b) Option

INSTEAD OF RELYING IN The -M Option To Determine What Needs to Be Updated, You 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 at the Same Time. The -b Option IS SLOWER THAN THE --M OPTION AND IS USUALLY UNNECESSARY.

If you us using this option in the previous example, The Command Would Be

DCC32 MySTUFF -B

Find Error (-f) Option

When a program terminates due to a runtime error, it displays an error code and the address at which the error occurred. By specifying that address in a -Faddress option, you can locate the statement in the source text that caused the error, provided your Program and UNITS WERE Compiled with debug information enabled (Via the $ D Compiler Directive).

In Order for the command-line compiler to find the runtime error with -f, you must compile the program with all the same command-line parameters you buy the first time you compiled it.

As mentioned previously, you must compile your program and units with debug information enabled for the command-line compiler to be able to find runtime errors. By default, all programs and units are compiled with debug information enabled, but if you turn it off, Using a {$ D-} Compiler Directive OR A - $ D- OPTION, The Command-Line Compiler Will Not Be Aable To Locate Runtime Errors.

Generate Object File (-J) Option

Using The -j Option Will Generate An Object File.

Use packages (-lu) Option

Use the -LU option to list additional runtime packages that you want to use in the application being compiled. Runtime packages already listed in the Project Options dialog box need not be repeated on the command line.Disable implicit compilation (-Z) option

The -Z option prevents packages and units from being implicitly recompiled later. With packages, it is equivalent to placing {$ IMPLICITBUILD OFF} in the .dpk file. Use -Z when compiling packages that provide low-level functionality, that change infrequently between Builds, or Whose Source Code Will Not Be Distributed.

Target File Extension (-TX) Option

The --tx option lets you override the default extension for the output file. For example,

DCC32 MySTUFF -TXSYS

Generates Compiled Output in a file called mystuff.sys.

Quiet (-q) Option

The quiet model Option Suppresses The Printing of File Names and Line NumBers During CompiLei IS Invoked with The Quiet Mode Option

DCC32 MySTUFF -Q

ITS OUTPUT IS LIMITED TO The Startup Copyright Message and The USUAL Statistics At The end of compilation. if any errors occur, they will be reported.

转载请注明原文地址:https://www.9cbs.com/read-76180.html

New Post(0)