Rules for globals usage
Follow the rules described in this topic in order to use globals properly.
Important:
Defining GLOBAL symbols (variables, constants, types)
is deprecated and should be avoided. Instead of globals, use PUBLIC
symbols in
modules to be imported with IMPORT
FGL
.
Rules for GLOBALS
usage:
- If you modify the globals file, you must recompile all the modules that include the file.
- If a local element has the same name as another variable that you declare in the
GLOBALS
statement, only the local variable is visible within its scope of reference. - You can declare several
GLOBALS .. END GLOBALS
blocks in the same module. - A source file with
GLOBALS .. END GLOBALS
block must not contain any executable statement. - Do not write a declaration statement outside a
GLOBALS ... END GLOBALS
block in the globals file. - You do not need to compile the source file containing the
GLOBALS
block. However, it is recommended to compile the globals file to detect errors. - You can declare several
GLOBALS "filename"
instructions in the same globals using module. - Although you can include multiple
GLOBALS ... END GLOBALS
statements in the same application, do not declare the same identifier within more than oneGLOBALS
declaration. Even if several declarations of a global elements defined in multiple places are identical, declaring any global element more than once can result in compilation errors or unpredictable runtime behavior. - A
GLOBALS .. END GLOBALS
block can holdGLOBALS "filename"
instructions. In such case, the specified files will be included recursively.