Creating Executables that Use Library Files

You can create a system executable application file that is linked to a shared library file or includes an archive file using the -l flag on the cob -x command line. The command line should have the following form:

cob -x filenames [-L dir] [-l name]

where the parameters are:

filenames
List of the files input to the cob command.
-L dir
Changes the order in which the system linker searches for libraries that were specified with the -l cob flag.
-l name
libname.so (or libname.a) is to be searched to resolve any references

This links all the application programs and subprograms with the specified libraries as well as the default COBOL run-time system libraries and operating system support libraries. The result is a system executable file that, when run, preloads the specified shared libraries before execution is passed to the main entry point.

When creating a system executable file, the code for any referenced modules that are held in shared libraries are not included in your system executable file. Instead, if such a module is referenced at run time, then the shared library is loaded into memory from the shared library file before control is passed to it.

The cob command uses a shared library in preference to an archive library of the same basename. If a cob flag names a library then cob assumes it is a shared library, but if no such library exists then it uses an archive library of the same name.

For example, if you specify two l