Futurebasic/Language/Reference/compile

COMPILE statement edit

COMPILE edit

Statement edit

✔ Appearance ✔ Standard ✔ Console

Syntax edit

COMPILE [tickCount][,compileFlags]

Description edit

While it is possible to place your own compile statements in source code, this is better accomplished by selecting items in the editor's preference window. Placing COMPILE statements in source code will void most of the selections made in the editor.

The COMPILE statement is used to change the way a program is compiled. The statement is optional: if you use it, it should not appear more than once in your program's source code, except possibly within different branches of a COMPILE LONG IF block. It is a non-executable statement, so you can't change its effect by putting it inside a conditional execution structure such as LONG IF...END IF. However, you can conditionally include or exclude it from the program by putting it inside a COMPILE LONG IF block.

Typically, the COMPILE statement is the first statement in the program.

tickCount sets the preferred number of ticks to occur between operating system calls.

compileFlags is a list of one or more symbolic constant names (separated by spaces) chosen from the set described below. compileFlags can also consist of a single integer constant equal to the sum of the individual symbolic constants.

Flag Description Default

_pointerVars (1)

Allocate a pointer in the application heap for variables (applies only when compiling a code resource). Allocate a handle in the application heap.
_sysHeapVars (2) Allocate a handle in the System heap for variables (applies only when compiling a code resource). Allocate a handle in the application heap.
_macsBugLabels (4) Generate information necessary for MacsBug to display your programÕs labels and function names. This is a useful feature for debugging, but makes your compiled code slightly larger. No MacsBug information is generated.
_strResource (8) Store all string constants found in the program as STR# resources. No STR# resources are created.
_dimmedVarsOnly (32) Generate an error if any variable is encountered before it is explicitly declared with a DIM statement. No DIM req'd for non-array, nonrecord vars (implicitly declared by appearance in code).
_noRedimVars(64) Generate an error if a DIM statement contains a variable that was previously encountered in the same scope (possibly in a previous DIM statement). Any DIM with a previously encountered variable is ignored.
_dontOptimizeStr (256) Prevents the compiler from removing duplicate strings when creating STR# resources in an application. This only applies if the _strResource flag is also set. Compiler removes duplicate strings.
_ChgConfig (32768) Instructs the compiler to override the options specified in ÒPreferencesÓ dialog when compiling this program (see the next table). The current ÒPreferencesÓ options are used.
_IncludeCDEF (65536) Add custom CDEF resource (for Geneva 9-point text or window text) to compiled applications. DonÕt add the resource.
_IncludeMDEF (262144) Add custom MDEF resource (for Geneva 9-point menu text) to compiled application. DonÕt add the resource.
_IncludeWDEF (524288) Add custom WDEF resource (for windoid-style palettes) to compiled application. DonÕt add the resource.
_ToolboxCall¬

  Required

(268435456)
Generates an error if references to Toolbox procedures are not preceded by the CALL keyword. CALL keyword is optional.
_ToolboxCall¬

  NotRequired

(536870912)
In Toolbox procedure references, the CALL keyword is optional. This is the same as the default. CALL keyword is optional.

Example edit

The following example tells the compiler to generate program labels and function names for MacsBug, and to require that all variables be explicitly declared. Tickcount is ignored if the code is used in an application.

COMPILE 0, _MacsBugLabels _dimmedVarsOnly

See Also edit

RESOURCES
COMPLIE LONG IF