Skip to content

Pre-Compilation

DataFlex allows you to mark a section at the top of your program for pre-compilation. Programs that contain a pre-compiled section will compile faster. The main restriction on the pre-compiled portion of your program is that it must be the first part of your program. If any lines of code are placed above the section that you have marked for pre-compilation, then the compiler will continue as though none of your program is pre-compiled.

There are two ways to achieve pre-compilation:

  • Pre-compiled packages: You can pre-compile any package file. If the Use statement for a pre-compiled package is on the first line of your program, then the compiler will use the pre-compiled code.
  • #HEADER … #ENDHEADER compiler directives: These directives mark a block of code for pre-compilation. You may not use a #HEADER … #ENDHEADER pair to split any compound statement (such as an object declaration).

An example of a program with a block marked for pre-compilation is shown below:

#HEADER
Use Windows.pkg
Use DFPanel.pkg
#ENDHEADER

Object oPanel is a Panel
    Set Label to "DataFlex"
    Set Size to 80 150

    Object oButton Is A Button
        Set Location to 40 10
        Set Label to "Exit"

        Procedure OnClick
            Delegate Send Deactivate
        End_Procedure
    End_Object
End_Object

Start_UI

Refer to the Compiler help for more information on pre-compiling packages and programs.