VMS Help
CC, Link libraries
*Conan The Librarian
|
The following describes how to link with the HP C Run-Time Library
(RTL).
Most linking needs should be satisfied by using the HP C RTL
shareable image DECC$SHR.EXE in the ALPHA$LIBRARY directory.
Because DECC$SHR.EXE has only prefixed names (no unprefixed names),
to successfully link against it, make sure you cause prefixing to
occur for all HP C RTL entry points. Do this by compiling in one
of two ways:
1. Compile with the /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES qualifier.
2. Compile with the /STANDARD=VAXC or /STANDARD=COMMON qualifier;
you get /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES as the default.
After making sure that all HP C RTL entry points are prefixed, link
against the shareable image using the LINK command. For example:
$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES PROG1
$ LINK PROG1
There are five object libraries provided with the HP C RTL:
o Object library included in STARLET.OLB
o VAXCRTL.OLB
o VAXCRTLD.OLB
o VAXCRTLT.OLB
o VAXCCURSE.OLB
The object library included in STARLET.OLB contains all code for
all functions. Each external name in this library has a DECC$
prefix, and, therefore, has an OpenVMS conformant name space (a
requirement for inclusion in STARLET.OLB).
The other three object libraries, VAXCRTL.OLB, VAXCRTLD.OLB, and
VAXCRTLT.OLB contain nonprefixed entry points that vector to the
appropriate code in STARLET.OLB, depending on the floating-point
type specified by the object library used:
o VAXCRTL.OLB contains all HP C RTL routine name entry points as
well as VAX G-floating double-precision, floating-point entry
points.
o VAXCRTLD.OLB contains a limited support of VAX D-floating
double-precision floating-point entry points.
o VAXCRTLT.OLB contains IEEE T-floating double-precision
floating-point entry points.
Note that, as with VAX C, if you specify more than one object
library on the LINK command, you must do so in the following order:
1. VAXCCURSE.OLB
2. VAXCRTLD.OLB or VAXCRTLT.OLB
3. VAXCRTL.OLB
In the default mode of the compiler (/STANDARD=ANSI89), all calls
to ANSI C standard library routines are automatically prefixed with
DECC$. With the /PREFIX_LIBRARY_ENTRIES qualifier, you can change
this to prefix all HP C RTL names with DECC$, or to not prefix any
HP C RTL names. Other options are also available for this
qualifer. See the /PREFIX_LIBRARY_ENTRIES qualifier for more
information.
When using the HP C RTL object libraries and linking with
/NOSYSSHR, if calls to the HP C RTL routines are prefixed with
DECC$, then the modules in STARLET.OLB are the only ones you need
to link against. Since STARLET.OLB is automatically searched by
the linker (unless the link qualifier /NOSYSLIB is used), all
prefixed RTL external names are automatically resolved.
If calls to the HP C RTL routines are not prefixed, then you need
to explicitly link against VAXCRTL.OLB, VAXCRTLD.OLB, VAXCRTLT.OLB,
depending on which floating-point types you need. If you are
linking with /NOSYSSHR, prefixed HP C RTL entry points are resolved
in STARLET.OLB. If you are not linking with /NOSYSSHR, prefixed HP
C RTL entry points are resolved in DECC$SHR.EXE.
1. Most of the time, you just want to link against the
shareable image. The linker automatically searches
IMAGELIB.OLB to find DECC$SHR.EXE:
$ CC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES PROG1
$ LINK PROG1
2. If you want to use just object libraries (to write
privileged code or for ease of distribution, for example),
use the /NOSYSSHR qualifier of the LINK command. Prefixed
RTL symbol references in the user program are resolved in
the HP C RTL object library contained in STARLET.OLB:
$ CC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES PROG1
$ LINK/NOSYSSHR PROG1
3. When compiling with prefixing disabled, in order to use
object libraries that provide alternate implementations of
C RTL functions, you need to use the VAXC*.OLB object
libraries. Unprefixed HP C RTL symbol references in the
user program are resolved in MYLIB and in VAXCRTL.OLB.
Prefixed HP C RTL symbol references in VAXCRTL.OLB are
resolved in DECC$SHR.EXE through IMAGELIB.OLB. In this
case, compile and link as follows:
$ CC/NOPREFIX_LIBRARY_ENTRIES PROG1
$ LINK PROG1, MYLIB/LIBRARY, ALPHA$LIBRARY:VAXCRTL.OLB/LIBRARY
4. You can, of course, link with any valid combination of
vaxcrtl.olb, vaxcrtld.olb, vaxcrtlt.olb, and vaxccurse.olb.
In this same example, to get IEEE T-floating double
precision, floating point support, you might use the
following compile and link commands:
$ CC/NOPREFIX_LIBRARY_ENTRIES/FLOAT=IEEE_FLOAT PROG1
$ LINK PROG1, MYLIB/LIBRARY, ALPHA$LIBRARY:VAXCRTLT.OLB/LIBRARY, -
_$ ALPHA$LIBRARY:VAXCRTL.OLB/LIBRARY
5. Combining examples 2 and 3, you might want to use just the
object libraries (for writing privileged code or for ease
of distribution) and use an bject library that provides C
RTL functions. Prefixed HP C RTL symbol references in
VAXCRTL.OLB are resolved in STARLET.OLB. In this case,
compile and link as follows:
$ CC/NOPREFIX_LIBRARY_ENTRIES PROG1
$ LINK/NOSYSSHR PROG1, ALPHA$LIBRARY:VAXCRTL.OLB/LIBRARY