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
GLOBALSstatement, only the local variable is visible within its scope of reference. - You can declare several
GLOBALS .. END GLOBALSblocks in the same module. - A source file with
GLOBALS .. END GLOBALSblock must not contain any executable statement. - Do not write a declaration statement outside a
GLOBALS ... END GLOBALSblock in the globals file. - You do not need to compile the source file containing the
GLOBALSblock. 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 GLOBALSstatements in the same application, do not declare the same identifier within more than oneGLOBALSdeclaration. 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 GLOBALSblock can holdGLOBALS "filename"instructions. In such case, the specified files will be included recursively.