The following table lists package-specific compiler directives that can be inserted into source code.
|
Directive |
Purpose |
|
{$IMPLICITBUILD OFF} |
Prevents a package from being implicitly recompiled later. Use in .dpk files when compiling packages that provide low-level functionality, that change infrequently between builds, or whose source code will not be distributed. |
|
{$G-} or {$IMPORTEDDATA OFF} |
Disables creation of imported data references. This directive increases memory-access efficiency, but prevents the unit where it occurs from referencing variables in other packages. |
|
{$WEAKPACKAGEUNIT ON} |
Packages unit weakly. |
|
{$DENYPACKAGEUNIT ON} |
Prevents unit from being placed in a package. |
|
{$DESIGNONLY ON} |
Compiles the package for installation in the IDE. (Put in .dpk file.) |
|
{$RUNONLY ON} |
Compiles the package as runtime only. (Put in .dpk file.) |
Including
{$DENYPACKAGEUNIT ON} in source code prevents the unit file from being
packaged. Including {$G-} or {$IMPORTEDDATA OFF} may prevent a
package from being used in the same application with other packages.
Other compiler directives may be included, if appropriate, in package source code.
Package-specific
command-line compiler switches
Using conditional directives
下表列出了包特有的编译指示,它们可以被插入到源代码中。
|
编译指示 |
用途 |
|
{$IMPLICITBUILD OFF} |
防止包在今后被隐含重编译。当编译的包提供低级功能,并且包几乎不会改变或其源代码不发布时,应使用该开关。 |
|
{$G-} or {$IMPORTEDDATA OFF} |
禁止创建或引入数据引用。使用该开关会提高内存访问效率,但会禁止包在编译时对其他包中变量的引用。 |
|
{$WEAKPACKAGEUNIT ON} |
低效封装单元(见编译指示:低效包装Weak packaging) |
|
{$DENYPACKAGEUNIT ON} |
防止被置于包中的单元。 |
|
{$DESIGNONLY ON} |
编译并将包安装到IDE。(置于.dpk文件中) |
|
{$RUNONLY ON} |
仅作为运行时包编译。(置于.dpk文件中) |
源代码中包括编译指示 {$DENYPACKAGEUNIT ON} 将防止被置于包中的单元文件。包括编译指示
{$G-} 或
{$IMPORTEDDATA OFF} 可以防止在同一应用程序中包被其他的包使用。
如果适当,在包的源代码中还可以包括其他的编译指示。
使用条件指示(见联机帮助)