HP aC++/HP C A.06.28 Programmer's Guide Integrity servers (769150-001, March 2014)

Library Options
Library options allow you to create, use, and manipulate libraries.
-b
-b
The -b option creates a shared library rather than an executable file.
Example:
The following command links utils.o and creates the shared library utils.so.
aCC -b utils.o -o utils.so
For more information on shared libraries, see “Creating and Using Libraries” (page 175).
-dynamic
-dynamic
The -dynamic option produces dynamically bound executables. See “-minshared” (page 50) for
partially statically bound executables.
The default is -dynamic.
-exec
-exec
The -exec option indicates that any object file created will be used to create an executable file.
Constants with a protected or hidden export class are placed in the read-only data section. This
option also implies -Bprotected_def. It makes all defined functions and data (even tentatively
defined data) protected by default (unless otherwise specified by another binding option or pragma).
-lname
-lname
The name value forms part of the name of a library the linker searches for when looking for routines
called by your program.
The -lname option causes the linker to search one of the following default libraries, if they exist,
in an attempt to resolve unresolved external references:
/usr/lib/lib/hpux32/name.so
/usr/lib/lib/hpux32/name.a
/opt/langtools/lib/hpux32lib/name.so
/opt/langtools/lib/hpux64lib/name.a
Whether it searches the shared library (.so) or the archive library (.a) depends on the value of
the -a linker option or the -minshared compiler option.
NOTE: Because a library is searched when its name is encountered, placement of a -l is
significant. If a file contains an unresolved external reference, the library containing the definition
must be placed after the file on the command line. For details refer to the description of ld in the
HP-UX Reference Manual or the ld(1) manpage for more information.
Example:
aCC file.o -lnumeric
This command directs the linker to link file.o and (by default) search the library /usr/lib/
hpux32/libnumeric.so.
Library Options 49