l

ld(1)

ld(1)

LANG

Determines the locale category for native language, local customs and coded character set in the absence of LC_ALL and other LC_* environment variables. If LANG is not speci®ed or is set to the empty string, a default of C (see lang(5)) is used instead of LANG.

LC_ALL

Determines the values for all locale categories and has precedence over LANG and other LC_* environment variables.

LC_MESSAGES

Determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

LC_NUMERIC

Determines the locale category for numeric formatting.

LC_CTYPE

Determines the locale category for character handling functions.

NLSPATH

Determines the location of message catalogs for the processing of LC_MESSAGES .

If any internationalization variable contains an invalid setting, ld behaves as if all internationalization variables are set to C. See environ(5).

In addition, the following environment variable affects ld:

TMPDIR

Speci®es a directory for temporary ®les (see tmpnam(3S)).

DIAGNOSTICS

ld returns zero when the link is successful. A non-zero return code indicates that an error occurred.

EXAMPLES

Link part of a C program for later processing by ld. (Note the .o suf®x for the output object ®le; this is an HP-UX convention for indicating a linkable object ®le):

ld -r file1.o file2.o -o prog.o

On 32-bit, link a simple FORTRAN program for use with the dde symbolic debugger (see dde(1)). Output ®le name is a.out since there is no -ooption in the command line.

ld /usr/ccs/lib/crt0.o ftn.o -lcl -lisamstub \ -lc /opt/langtools/lib/end.o

To do this on 64-bit:

ld ftn.o -lcl -lisamstub \

-lc /opt/langtools/lib/pa20_64/end.o

On 64-bit, link a shared bound program in standard mode. Note that crt0.o is not speci®ed because for shared links, it is no longer necessary.

ld himom.o +std -lc

On 64-bit, link a compatibility mode program. crt0.o is included because this is an archive link.

ld /opt/langtools/lib/pa20_64/crt0.o himom.o +compat -a archive -lc

Create a shared library:

ld -b -o libfunc.sl func1.o func2.o func3.o

Create a shared library with an internal name:

ld -b -o libfoo1.1 foo1.o foo2.o +h libfoo1.1 ln -s libfoo1.1 libfoo1.sl

cc-g mytest.c -L. -lfoo1 chatr a.out

...

shared library list: dynamic ./libfoo1.1

Section 1436

− 14 −

HP-UX Release 11i: December 2000