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

Linking to C++ Libraries
You can compile and link any C++ module to one or more libraries. HP aC++ automatically links
the following libraries with a C++ executable.
/usr/lib/hpux##/libCsup.so (the HP aC++ runtime support library)
/usr/lib/hpux##/libstd_v2.so (standard C++ library: -AA)
/usr/lib/hpux##/libc.so (the HP-UX system library)
/usr/lib/hpux##/libdl.so (routines to manage shared libraries)
/usr/lib/hpux##/libunwind.so (routines to unwind exceptions)
/usr/lib/hpux##/libm.so (math library)
NOTE:
When you specify the -b option to create a shared library, these defaults do not apply.
When you specify the +std=c++11 (or the currently deprecated -Ax) option during the link
time, libCsup11.so gets linked instead of libCsup.so.
Linking with Shared or Archive Libraries
If you want archive libraries instead of shared libraries, use the -a, archive linker option. To create
a completely archived executable, use the +A option. To maintain compatibility with future releases,
do not mix archive and shared libraries should not be mixed.
Refer to the HP-UX Linker and Libraries User’s Guide for more information.
Specifying Other Libraries
You can specify other libraries using the -l option. For example, to use the Tools.h++ library (-AA
version), specify -lrwtool_v2:
aCC myapp.C -lrwtool_v2
Creating and Using Shared Libraries
This section describes shared libraries that are specific to HP aC++. It discusses the following
topics:
Compiling for Shared Libraries
Creating a Shared Library
Using a Shared Library
Linking Archive or Shared Libraries
Updating a Shared Library
Compiling for Shared Libraries
To create a C++ shared library, you must first compile your C++ source with either the +z or +Z
option. These options create object files containing position-independent code (PIC).
Example
The following example compiles util.C, generates position-independent code, and puts the code
into the object file util.o. util.This object file can later be put into a shared library.
aCC -c +z util.C
180 Tools and Libraries