The -z flag creates a callable shared object file from the files input to the cob command. This file can then be called by COBOL executables.
Input files can be any file type except .gnt files. If you use object module files (.o), they are linked in using the system linker (ld).
The CC option enables you to also link C++ objects into the library file. If C++ ( .C) source files are specified, the C++ compiler is invoked to compile them to object code first.
The PLI option enables you to include PL/I run-time system support for the callable shared object produced.
The source code files are compiled into intermediate code, generated to object code (.o) files, and then linked to create a dynamically loadable callable shared object.
By default, the base-name of the resulting shared object file takes the name of the first object being linked, and has the filename extension .so. The base-name forms the main entry point, but this can be overridden using the -e flag.
The U option specifies that an error message should be issued if there are any undefined symbols.
If the -g flag is also specified, the resulting callable shared object contains debugging information so that it can be debugged with Animator.
The following examples illustrate the types of processing available using the -z flag:
cob Command line | Output files |
---|---|
cob -z tmp/a.cbl |
a.int, a.idy, a.o, a.so |
cob -z b.cbl |
b.int, b.idy, b.o, b.so |
cob -z a.int |
a.o, a.so |
cob -z c.o |
c.so |
cob -zg a.cbl |
a.int, a.idy, a.o, a.so |
cob -z,CC cobprg.cbl cprg.C |
cobprg.int, cobprg.idy, cobprg.o, cprg.o, cobprg.so |
cob -z,PLI pliprg.o |
pliprog.so |
To run the resulting executable files produced using these commands, use the cobrun command.