Previous Topic Next topic Print topic


Entry Points

Several COBOL programs can be combined into a single callable shared object. This has the advantage that any references between the COBOL programs can be resolved using direct references without having to use the dynamic loader to search for and then load another module. For example, the following command, compiles all the COBOL programs and links them together, creating myprog.so. The main entry point is myprog, which is the main entry point of the first COBOL program specified, myprog.cbl.

cob -z myprog.cbl subprog.cbl entry.cbl

The name of the created callable shared object can be specified with the -o cob flag. For example, the following command compiles all the COBOL programs and links them together, creating entry.so. Here, the basename of the callable shared object entry is used as the main entry point; entry is the main entry point of entry.cbl.

cob -zo entry.so myprog.cbl subprog.cbl entry.cbl

The entry point can also be specified with the -e cob option. This is useful if your application name is not the same as your source program filenames. For example, the following command compiles all the COBOL programs and links them together, creating myapp.so. The main entry point is specified as entry, which is the main entry point of entry.cbl. Any entry point in any of the COBOL programs could be specified with the -e option.

cob -zo myapp.so myprog.cbl subprog.cbl entry.cbl -e entry

If no -e option is specified then the basename of the callable shared object is used as the main entry point. If the main entry point cannot be found at run time, the callable shared object cannot be loaded and a run-time load error results.

Previous Topic Next topic Print topic