HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
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.
For example, when a module in an existing shared library requires a fix, recompile the
fixed module with the +z or +Z option, and recreate the shared library with the -b
option.
Programs that use this library will now use the new versions of the routines. You do not
have to relink programs that use this shared library because they are attached at run
time.
Creating and Using Libraries 227