Macros and Compiled Programs

Macro substitution takes place only when the software is parsing a source (uncompiled) program.

During compilation, the software parses the source code and performs macro substitution based on current macro values. The resulting commands are then compile and stored in compiled form.

When the compiled program is executed, its source code is not parsed again. Therefore, changes to macro values in the interim are not reflected when the compiled program is executed.

For this reason, programs that use macros should not normally be compiled.

Problems that can arise

Consider a program called ExtremeCase that contains a single line of code:

#< CommandLine>

The program ExtremeCase could contain any command, depending on the character string value assigned to the macro < CommandLine>.

If ExtremeCase is not compiled, executing the commands

let <CommandLine> = 'list all Employees'
let <CommandLine> = 'form open fTotals'

is equivalent to executing

list all Employees
form open fTotals

If ExtremeCase were to be compiled at this point, the command that would be compiled is

form open fTotals

From this point forward, executing the compiled program ExtremeCase would always result in the execution of the FORM OPEN command, regardless of the current value of the macro <CommandLine>.

If you choose to compile

IF you choose to compile programs that use macros, keep the following principles in mind:

Macros vs Variables

Although macros appear to behave as variables do, they are, in fact, quite different:

On the other hand