Use the linker to link specified object files and create an executable file or a shared object.
You have a choice of ways to start the linker. You can use:
Each of these commands calls the linker unless you specify the -c option. For details about which command to use for which type of application, see the related task about compiling from the command line.
cob2, cob2_j, and cob2_r link with the COBOL multithreaded libraries. Additionally, cob2_j links with the Java Native Interface (JNI) runtime libraries.
Linking with C: The linker accepts .o files, but does not accept .c files. If you want to link C and COBOL files together, first produce .o files for the C source files by using the xlc -c command.
You can invoke the linker explicitly by using the ld command. However, the compiler invocation commands pass several linker options and library-names to the linker automatically. In most cases, it is better to use one of the compiler invocation commands to link-edit .o files.
You can use a makefile to organize the sequence of actions (such as compiling and linking) that are required for building your program. In the makefile, you can use linker statements to specify the kind of output that you need.
You can specify linker options using any of the methods described above.