Previous Topic Next topic Print topic


Creating Executables that Use the Dynamic Loader

The dynamic loader enables callable file formats to be loaded dynamically at run-time. The dynamic loader can also be selected by cob flags used to build a system executable with:

Specifying the cob option -d symb causes the system executable to be built so that if the program named symb is called at run time, it is loaded dynamically; cob gives an error if the program is presented to cob for static linking.

Specifying the cob -e"" flag causes the system executable to be built so that the executable file's entry point must be specified at run time. You specify the entry point at run time by including the name of the entry point on the command line. The dynamic loader is used to locate the named program, first checking if the program is linked or previously loaded and, if not, trying to load the program dynamically.

The statement CALL data-name and any CALL statement that includes an ON EXCEPTION clause implies use of the dynamic loader. However, you might not want dynamic loading, for example if the subprogram to be called is a C routine. If the sub-program is called using the dynamic loader, then if the sub-program is linked into the system executable file, the linked version is used and no attempt is made at run time to dynamically load it.

If you have a subprogram in an archive library and you do not want the subprogram to be dynamically loaded you can ensure that it is linked by using one of the following:

Alternatively, the archive library can be turned into a shared library using the -Z cob flag.

Previous Topic Next topic Print topic