Syntax
where, |
|
Selects archive libraries. If the archive library does not exist, | |
| the linker generates a warning message and does not create the |
| output file. |
If archive_shared is active, the archive form is preferred, | |
| but the shared form is allowed. |
Selects shared libraries. If shared libraries do not exist, the | |
| linker generates a warning message and does not create the |
| output file. |
If shared_archive is active, the shared form is preferred, but | |
| the archive form is allowed. |
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
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
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.
Advanced Shared Library Features
This section explains additional things you can perform with shared libraries. It discusses the following topics:
•Forcing the Export of Symbols in main
•Side Effects of C++ Shared Libraries
•Routines and Options to Manage C++ Shared Libraries
•Version Control for Shared Libraries
•Adding New Versions to a Shared Library
Forcing the Export of Symbols in main
By default, the linker exports from a program only those symbols that were imported by a shared library. For example, if shared libraries of an executable does not reference the main routine of the program, the linker does not include the main symbol in the export list of a.out.
Normally, this is a problem only when a program explicitly calls shared library management routines. (See “Routines and Options to Manage C++ Shared Libraries” (page 183).)
To make the linker export all symbols from a program, use the
182 Tools and Libraries