Compiled 42m modules can be grouped in libraries by using the fgllink linker. The library files get the 42x extension. If none of the modules defines the MAIN block, the linker creates a library; if a MAIN block is present, the linker creates a program, that should use a 42r extension.
Note that linking is supported for backward compatibility, you should use IMPORT FGL instead.
Library linking is done with the fglrun tool by using the -l option. The fgllink tool can be used for convenience, it is a simple script calling fglrun -l.
$ fglcomp fileutils.4gl $ fglcomp userutils.4gl $ fgllink -o libutils.42x fileutils.42m userutils.42m
When you create a library, all functions of the 42m modules used in the link command are registered in the 42x file.
Keep in mind that the 42x library file does not contain the 42m p-code. When deploying your application, you must provide all compiled 42m modules.
When creating a 42x library, all functions must be uniquely defined; otherwise, error -6203 will be returned by the linker.
The 42x libraries are typically used to link the final 42r programs:
$ fglcomp mymain.4gl $ fgllink -o myprog.42r mymain.42m libutils.42x
The 42r programs must be re-linked if the content of 42x libraries have changed. In this example, if a function of the userutils.4gl source file was removed, you must recompile userutils.4gl, re-link the libutils.42x library and re-link the myprog.42r program.
$ fglcomp module_1.4gl $ fglcomp module_2.4gl $ fgllink -o lib_A.42x module_1.42m $ fgllink -o lib_B.42x module_2.42m lib_A.42x $ fgllink -o myprog.42r lib_B.42x -- will hold functions of module_1 and module_2.
If you do not specify an absolute path for a file, the linker searches by default for .42m modules and .42x libraries in the current directory. You can specify a search path with the FGLLDPATH environment variable.
$ fgllink -e extlib,extlib2,extlib3 -o libutils.42x fileutils.42m userutils.42m