IMPORT statement is used to import precompiled resources into a 4GL program.
Syntax:
Element |
Description |
File |
An identifier which refers to a valid file name without path or extension |
Usage and examples:
With IMPORT statement, 4gl developers can import:
compiled .4gl files and compiled 4GL libraries (IMPORT FGL),
C extension libraries (IMPORT),
JAVA classes (IMPORT JAVA).
IMPORT statement must be introduced at the beginning of a source file before all other sections including MAIN, FUNCTION, DEFINE, and GLOBALS:
IMPORT fgl_lib
MAIN
...
END MAIN
Every imported module or library needs its own IMPORT statement. If you want to import several modules, use several IMPORT statements:
IMPORT fgl_lib
IMPORT my_lib
MAIN
...
END MAIN
Usually in 4GL, if a program refers to a file, it needs the path to the file, its name and extension (they are given in quotation marks). However, with the IMPORT statement, the file name serves as the identifier which can be later used in the code:
IMPORT c_lib
MAIN
CALL c_func("Hello World") -- a function defined in c_lib
END MAIN
If the imported module calls any functions, you can call them from the importing 4gl source file without linking them explicitly to the program.
This chapter discusses importing 4gl modules and C libraries.
To get the necessary information about importing JAVA classes, please, refer to Lycia 3 Java Interface.
Related articles:
Java Classes and Objects in 4GL
4GL Identifiers Specification
Environment variables