RAD Studio
Using Precompiled Header Files

Precompiled header files can dramatically increase compilation speed by storing an image of the symbol table on disk in a file, then later reloading that file from disk instead of parsing all the header files again. Directly loading the symbol table from disk is much faster than parsing the text of header files, especially if several source files include the same header file.  

To use precompiled header files, specify the various ‑H options in your BCC32 command.  

Precompiled Header Options  

Compiler Option 
Generate and use  
When you enable this option, the compiler generates and uses precompiled headers. The default file name is BC32DEF.CSM for the command-line compiler.  
Use but do not generate  
When you enable this option, the compiler uses preexisting precompiled header files; new precompiled header files are not generated.  



Do not generate or use  
When you enable this option, the compiler does not generate or use precompiled headers. Default = Do not generate or use (-H-)  
Cache precompiled headers  
When you enable this option, the compiler caches the precompiled headers it generates. This is useful when you are precompiling more than one header file. To use this option, you must also enable the Generate and Use (-H) precompiled header option. Default = Off.  
Generate external type files (precompiled headers)  
When you enable this option, the compiler generates a file or files that contain debug type information for all the symbols contained in the precompiled headers. The filenames end with .#xx extension, where xx is 00 for the first file generated and is incremented for each additional type-information file required. Using this option dramatically decreases the size of your .OBJ files, because debug type information is centralized and is not duplicated in each .OBJ file. Default = On.  
Precompiled header filename  
Use this option to specify the name of your precompiled header file. When you set this option, the compiler generates and uses the precompiled header file that you specify.  
-Hh=<xxx> or -H\”<xxx>\”  
Stop precompiling after header file option  
This option terminates compiling the precompiled header after processing the file specified as xxx. You can use this option to reduce the disk space required for precompiled headers.
The -Hh syntax is generally easier to use than the -H syntax. Examples:
-Hh="C:\Program Files\myhdr.h"
-H\"C:\Program Files\myhdr.h\"
When you use this option, the file you specify must be included from a source file for the compiler to generate a precompiled header file.
You can also use #pragma hdrstop in your source file to specify when to stop the generation of precompiled headers.
You cannot specify a header file that is included from another header file. For example, you cannot list a header included by windows.h because doing this would cause the precompiled header file to be closed before the compilation of windows.h was completed.  
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!