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
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
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