Previous Topic Next topic Print topic


Dynamic Loading

You can run programs or subprograms without linking them, by creating them as dynamically loadable.

The COBOL system enables each call to a program to be either linked directly to the program, if it is available at link time, or to be linked to the dynamic loader. At run time the dynamic loader searches for the named program and, if necessary, dynamically loads it.

Dynamically loadable executable files are callable shared objects, .int files or .gnt files. Callable shared objects enable any type of program or subprogram (for example, COBOL, C or C++) to be dynamically loaded. For .int and .gnt files, only COBOL programs or subprograms can be dynamically loaded.

Dynamically loadable files do not require linking, but they do need a system executable as a trigger, which is cobrun (or cobrun_t for multi-threaded applications).

The program name can be provided to the dynamic loader as either a literal or as the value of a data item. The dynamic loader searches for the named program in the following places:

  1. The list of linked programs, subprograms and routines in memory.
  2. The file system for a dynamically loadable file for the program.

You can use flags to the cob command to explicitly name the programs that you want to be linked and directly referenced and those that you want to be dynamically loaded. Without explicit instructions, cob takes default actions that depend on how the COBOL source calls the program.

Previous Topic Next topic Print topic