Delphi dcc32 command line compiling Delphi project source code

Source: Internet
Author: User

Link: http://blog.csdn.net/sushengmiyan/article/details/10284879

Author: su shenmiyan

Borland's Delphi, in TianyiPublished in AugustProgramming LanguageThe ranking has dropped to 14. Although the ranking is declining, it can still be seen that there are still a lot of people using Delphi for programming. Delphi is indeed a little outdated, and Borland is not enough, especially lack of network support, delphi's current situation is acceptable, but it is also undeniable that Delphi is applied on the quick interface.ProgramDevelopment still has incomparable advantages. Maybe that is why it still has such powerful vitality. Okay. You don't have to talk about it. Start to enter the topic:Dcc32 compile the program.

Usually, you can use Delphi ide to directly compile the program without using dcc32 command line. However, when the project grows to a certain scale, or when you get tired of IDE-like Compilation speed in big projects, you may have the idea that you can write segments.CodeAnd then run the code or script to compile the project. Well, if you have such an ideaArticleIt suits your taste.


1. First, find this executable file. People familiar with Delphi should easily find it and open the directory where you install Delphi, such as my path c: \ Program Files \ delphi_2007 \ bin \ dcc32.exe

2. Copy a copy and place it in my test directory: F: \ SRC \ qmsg \ build

3. Now we can test this command. Use the Windows cmd command to switch to the directory where the current dcc32 is located. First enter F: Switch to f disk, then enter cd f: \ SRC \ qmsg \ build

Switch to the directory where dcc32 is located, and enter the dcc32 command, for example:


When this interface appears, it indicates that you have successfully called the dcc32 command. The following are some compilation commands and commands collected. If you are interested, you can manually write the code and compile the code. I will not elaborate on it here.

Delphi'scommand line compilers (dcc32.exe) allow you to use the doscommand line (see idecommand line to extract all functions of idecompiler (delphi32.exe. Run the command line compiler syntax using the doscommand:

Dcc32 [Option] [file name] [Option]

Zero or multiple parameters provide information to the compiler. The file name specifies the name of the source file to be compiled. If you enter dcc32 separately, it will display a screen on the options and syntax of command line compilation.

If the file name does not have an extension, the command line compiler looks for a file with the same name as. DPR. If the file cannot be found, it looks for a file with the same name extension. Pas. If your source file does not have an extension, you need to add (.) at the end of the file name (.).

If the specified source file is a project file, the compiler creates an executable file with the same name as. EXE. If the specified source file is a library file, the compiler creates a dynamic link library file with the same name as. dll. If the specified source file is a package file, the compiler creates a package with the same name extension. BPL. If the specified source file is a unit file, the compiler creates a target code file with the extension of. DCU.

You can specify multiple parameters for the command line compiler. A parameter consists of a break "-" (or "/") and an option character that follows. Generally, option characters are followed by additional information, such as a number, a symbol, and a directory. Options can be in any order and can be before or after the source file name.

Similarly, Delphi supports compiler commands described by keywords of compiler commands. Use the "$" and "d" command line options to change the status of all default compilers. The "$" and "d" command line options are equivalent to adding a compiler command before the source file.

Compiler Command Option Switch

'$' Allows you to change the default state of each compiler instruction. The syntax of a compiler instruction is "$" followed by a single instruction character, followed by "-" or "+ ". For example:

Dcc32 mystuff-$ R-

 

Compile the mystuff. Pas unit without using the boundary check:

Dcc32 mystuff-$ R +

Use the interface to check and compile the mystuff. Pas unit. If you add the compiler instruction {$ R +} or {$ R-} to the beginning of the source file, it overwrites the parameters passed in from the command line.

You can use multiple "$" to specify multiple compiler commands, such:

Dcc32 mystuff-$ r -- $ I -- $ v -- $ U +

The command line compiler allows comma-separated compilers to specify a list, for example:

Dcc32 mystuff-$ R-, I-, V-, U +

You only need to use a "$" symbol.

Note: Because the format of $ M is different, you cannot use $ m in the comma-separated command list.

 

Conditional compilation options

The "-d" option allows you to define a compilation condition that complies with the compiler instructions you have defined with {$ definesymbol. The "-d" option must follow one or more compilation condition symbols separated by semicolons. the following command:

Dcc32 MYSTUFF-DIOCHECK; debug; List

Three compilation condition symbols are defined: iocheck, debug, and list, which are used in the mystuff. Pas unit. This is equivalent to inserting the following statement into the source file:

{$ Defineiocheck}

{$ Define debug}

{$ Define list}

If you specify multiple "-d" options, you can join them as follows:

MYSTUFF-DIOCHECK-DDEBUG-DLIST dcc32

This is equivalent to the first example.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.