Importing 4GL modules

Compiled 4gl source files as well as compiled 4gl libraries can be imported to any 4gl program by IMPORT FGL statement:

IMPORT FGL fgl_lib

IMPORT FGL fgl_file

MAIN

...

END MAIN

When importing compiled files (.4o) and libraries (.4a) by IMPORT FGL, use only filename without file extensions.

 

If you import any 4gl module in such a way, there will be no need to link it to the program by means qlink.

 

No circular imports are allowed: If import module A from module B, and module B from module A, compilation will fail.

 

After any 4gl module was imported, its functions, variables, constants, and data types become available for and from the importing source module and can be called like any other 4GL function, variable, etc.:

IMPORT FGL fgl_lib

MAIN

  CALL myfunction() -- function defined in fgl_lib

END MAIN

 

By default, all the elements listed above are private. To make them public, use PUBLIC keyword when declaring them:

IMPORT FGL fgl_lib

PUBLIC DEFINE var INT

MAIN

...

END MAIN

Note: If the modules or libraries that are imported using the IMPORT FGL statement are located in the program different from the program or library that uses them, then all the folders containing those modules or libraries must be listed in FGLLDPATH.

 

For importing objects organized into folders and sub-folders, use the dot separator:

IMPORT FGL lib.lib1

IMPORT FGL lib.lib2

IMPORT FGL lib.lib3

To disable this behaviour (for example, if files have dots in names), use the QX_ALLOW_DOT_PACKAGE_SEPARATOR variable for qfgl to treat a dot not as a subfolder indication, but as a part of the file name. Alternatively, if one of your sources has a name with a dot in it, export that variable in your console and then compile this file separately in your console using qfgl.

 

For building rules for programs containing the IMPORT FGL statement, refer here: Building a Program Containing the IMPORT FGL Statement

 

Contact Us

Privacy Policy

Copyright © 2026 Querix, (UK) Ltd.