Incremental Compilation
Most programs during development are composed of a "static" part that does not usually change and a dynamic part that is recompiled often. Multiple use statements are a common example of the first part of a program that may be considered static. This static portion of your program is called the "header." You may define the header of your program and compile that portion only once. The header will be automatically included, precompiled, when you compile the dynamic portion of your program. This technique can significantly reduce the time it takes to recompile a large program. It can also be used to give access to part of the source code of a program to users while keeping another part inaccessible to them.
You may define a header of your program for precompilation with the #HEADER and #ENDHEADER commands. With df-cli, precompile that header with df-cli build-file MyProgram.src --precompile --workspace <path-to-sws> --output-dir <output-dir>. The command produces MyProgram.FLD, MyProgram.PBG, MyProgram.PKD, and MyProgram.PRP in the selected output directory. Compile the source normally with df-cli build-file MyProgram.src --workspace <path-to-sws> --output-dir <output-dir>; the .FLD is included and the header is not recompiled. If --output-dir is omitted, df-cli build-file uses the source file's directory. As portions of your program become complete and tested, you may move them into the header and recompile the header. It is your responsibility to recompile the header every time it changes.
For example:
#HEADER
Use Windows.pkg
Use cMyCustomGrid.pkg
#ENDHEADER
:
Object oMyCustomGrid1 is a cMyCustomGrid
:
End_Object