When I attempt to create a new package in Delphi XE2, there is a new construct in package dpk source file: IMPLICITBUILDING
What is that for?
package Package1;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$IMPLICITBUILD ON}
requires
rtl;
end.
Please also see this discussion: Why does Delphi change Indy's dpk source file when I change project options and this.
"The compiler directives which appear between the $IFDEF IMPLICITBUILDING and $ENDIF are normally passed as parameters by the compiler when explicitly compiling a package. Because these options change based on the configuration (debug / release) and target platform (Win32, Win64, OSX32) it's problematic to have them statically defined in the package project source. When defined in the project source they will always override the options passed by the compiler. The $IFDEF prevents these options from being used during explicit compilation.
In cases where a package is implicitly compiled these options will be used, but unless your project was saved in the configuration / target mode you want to compile for, you may not get the results you expect.
As a general rule, it's better to disable implicit building on packages and compile them explicitly via a project group build or through project dependencies. If you are building for only a single platform using a single configuration then the implicit building mechanism is adequate.
IMPLICITBUILDING is defined by the compiler during the compilation of a package that is being implicitly compiled as part of the compilation of something that depends on it. As indicated in the comment you should not be trying to define this value yourself"
I assume it is related to the {$IMPLICITBUILD ON} flag below the conditional block. I guess that it is set as long as the compiler is performing the implicit build (compared to an explicit build). I have no idea why the settings should only be regarded if that is the case. It is certainly not documented yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With