HP aC++/HP C A.06.25 Programmer's Guide
Linking Archive or Shared Libraries
When an archive and shared version of a particular library reside in the same directory,
the linker links in the shared version by default. You can override this behavior with
the -a linker option.
NOTE: Use the +A option when using only archive libraries to create a completely
archived executable.
The -a option identifies the library type for the linker. The -a option is positional and
applies to all subsequent libraries specified with the -l option until the end of the
command line or until the next -a option is encountered. Pass the -a option to the
linker with the -Wx,args option.
Syntax
-Wl,-a,{archive|shared|shared_archive|archive_shared|default}
where,
-Wl,-a,archive
Selects archive libraries. If the archive library does not
exist, the linker generates a warning message and
does not create the output file.
-Wl,-a,archive_shared
If archive_shared is active, the archive form is preferred,
but the shared form is allowed.
-Wl,-a,shared
Selects shared libraries. If shared libraries do not exist,
the linker generates a warning message and does not
create the output file.
-Wl,-a,shared_archive
If shared_archive is active, the shared form is preferred,
but the archive form is allowed.
-Wl,-a,default
Selects the shared library. If the shared library does not
exist, the linker selects the archive library.
Example
The following example directs the linker to use the archive version of the library
libshape, followed by standard shared libraries if they exist; otherwise select archive
versions.
aCC box.o sphere.o -Wl,-a,archive -lshape -Wl,-a,default
Updating a Shared Library
The aCC command cannot replace or delete object modules in a shared library. To
update a C++ shared library, you must recreate the library with all the object files you
want the library to include.
238 Tools and Libraries