Passing options to the linker

You can specify linker options in any of these ways: an invocation command (cob2) or makefile statements.

About this task

Any options that you specify in an invocation command that are not recognized by the command are passed to the linker.

Several invocation command options influence the linking of your program. For details about the set of options for a given command, consult documentation for that command.

The following table shows the options that you are more likely to need for your COBOL programs. Precede each option with a hyphen (-) as shown.

Table 1. Common linker options
Option Purpose
-Ldir Specifies the directory to search for libraries specified by the -l option (default: /usr/lib)
-lname Searches the specified library-file, where name selects the file libname.a

Examples: using cob2 for linking