Previous Topic Next topic Print topic


Compile to Callable Shared Object (-z[,U][,CC])

Compiles the COBOL source code files (.cbl, .CBL or .cob) into intermediate code and then generates them to object code (.o) files, and then links these to create dynamically loadable callable shared objects. These files have the file extension .so.

If the -g flag is also specified, the resulting callable shared object contains debugging information so that it can be debugged with Animator.

Multiple programs can be combined to form a single callable shared object, system executable or shared library. Here the main entry point is the basename of the first program on the command line unless the cob -e flag is specified.

You can supply intermediate code files to the cob command instead of COBOL source code files; these are generated to object code. You can also supply object module files (.o) to the cob command; these are linked using the system linker (ld) to create the dynamically loadable callable shared object.

The U option specifies that an error message should be issued if there are any undefined symbols.

The CC option to the -z flag enables you to link COBOL and C++ objects into a callable shared object. If C++ source files (.C) are specified, the C++ compiler is invoked to compile them to object code first.

For example, if you want to link the C++ program cprg.C and the COBOL program cobprg.cbl, use the following command:

cob -z,CC cobprg.cbl cprg.C 

Example:

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.so
cob -z b.cbl 
b.int, b.so
cob -z a.int 
a.so
cob -z c.o 
c.so
cob -zg a.cbl 
a.int, a.idy, a.so
Previous Topic Next topic Print topic