$ cc
...
/usr/ccs/bin/ld /opt/langtools/lib/crt0.o cursesprog.o
cc: informational note 413: Entering Link editor.
Linking with the crt0.o Startup File in
Notice also, in the above example, that the compiler linked cursesprog.o with the file /opt/langtools/lib/crt0.o. This file contains object code that performs tasks which must be executed when a program starts running - for example, retrieving any arguments specified on the command line when the program is invoked. For details on this file, see “The crt0.o Startup File” (page 21)
Suppressing the
The
$ f90 | //Produce .o for | func.f. | |||
$ ls func.o |
|
|
| ||
func.o |
|
|
|
| |
$ | f90 | main.f func.o | //Compile main.f | with | func.o |
$ | a.out | //Run it to verify it | worked. |
Using Linker Commands
This section describes linker commands for the
NOTE: Unless otherwise noted, all examples show
Linking with the crt0.o Startup File
In default mode, you need not include crt0.o on the link line. However, you must include crt0.o on the link line for all fully archive links (ld
See “The crt0.o Startup File” (page 21), and crt0(3) manpage for more information.
Changing the Default Library Search Path with
You can change or override the default linker search path by using the LPATH environment variable, the
Overriding the Default Linker Search Path with LPATH
The LPATH environment variable allows you to specify which directories ld should search. If LPATH is not set, ld searches the default directory /usr/lib. If LPATH is set, ld searches only the directories specified in LPATH; the default directories are not searched unless they are specified in LPATH.
If set, LPATH must contain a list of
30 Determining How to Link Programs or Libraries (Linker Tasks)