Linking programs
Use the linker to link specified object files and create an executable file or a shared object.
About this task
You have a choice of ways to start the linker. You can use:
- The
cob2
command:This command calls the linker unless you specify the
-c
option.cob2
links with the COBOL multithreaded libraries, so there is no need for any additional thread options.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 gcc command.
- A makefile:
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.