ld Manual

Introduction to ld
ld Manual529650.001
1-9
Linking Programs
Linking Programs
C Programs
C programs require access to their run-time environments. To create an executable C
program, you must link to the run-time environment initialization code and the DLLs
your program uses. The NMC and c89 compilers automatically link to the required
items. If you use ld directly to link a C program, you must specify these items in ld
options.
To create an executable C program using ld:
1. Link together the object code files that you compiled.
2. Link to the C run-time library initialization object code file:
3. Link to the run-time libraries that your program uses. To link the standard set of C
run-time libraries, use these options:
4. If your program uses active backup programming functions, such as
__ns_start_backup(), link to the active backup programming support object
code file:
For information about active backup programming in C, see the Guardian
Programmer’s Guide.
Note. You can link only linkfiles into a program. You cannot link loadfiles, or a combination of
loadfiles and linkfiles, into a program.
Environment Run-Time Library Initialization Object Code File
Guardian $SYSTEM.SYSTEM.CCPPMAIN
OSS /usr/lib/ccppmain.o
Environment Option for Linking Standard C Run-Time Libs
Guardian -OBEY $SYSTEM.SYSTEM.LIBCOBEY
OSS
-obey /usr/lib/libc.obey
Environment Active Backup Programming Support Object Code File
Guardian $SYSTEM.SYSTEM.CRTLNS2
OSS /usr/lib/crtlns2.o