Several libraries are shipped with the C++ compiler. Some of these libraries are available only in compatibility mode (-compat=4), some are available only in the standard mode (–compat=5), and some are available in both modes. The libgc and libdemangle libraries have a C interface and can be linked to an application in either mode.
The following table lists the libraries that are shipped with the C++ compiler and the modes in which they are available.
Table 12–1 Libraries Shipped With the C++ Compiler
Library |
Description |
Available Modes |
---|---|---|
libstlport |
STLport implementation of the standard library. |
–compat=5 |
libstlport_dbg |
STLport library for debug mode |
–compat=5 |
C++ runtime |
–compat=5 |
|
C++ standard library |
–compat=5 |
|
Classic iostreams |
–compat=5 |
|
C++ runtime, classic iostreams |
–compat=4 |
|
Supports the -xia option |
–compat=5 |
|
complex library |
–compat=4 |
|
librwtool |
Tools.h++ 7 |
–compat=4,– compat=5 |
Debug-enabled Tools.h++ 7 |
–compat=4,–compat=5 |
|
Garbage collection |
C interface |
|
Demangling |
C interface |
Do not redefine or modify any of the configuration macros for STLport, Rogue Wave or Sun Microsystems C++ libraries. The libraries are configured and built in a way that works with the C++ compiler. libCstd and Tool.h++ are configured to inter-operate so modifying the configuration macros results in programs that will not compile, will not link, or do not run properly.
A brief description of each of these libraries follows.
libCrun: This library contains the runtime support needed by the compiler in the standard mode (–compat=5). It provides support for new/delete, exceptions, and RTTI.
libCstd: This is the C++ standard library. In particular, it includes iostreams. If you have existing sources that use the classic iostreams and you want to make use of the standard iostreams, you have to modify your sources to conform to the new interface. See the C++ Standard Library Reference online manual for details. You can access this manual by pointing your web browser to:
file:/opt/SUNWspro/docs/index.html |
If your compiler software is not installed in the /opt directory, ask your system administrator for the equivalent path on your system.
libiostream: This is the classic iostreams library built with– compat=5. If you have existing sources that use the classic iostreams and you want to compile these sources with the standard mode (–compat=5), you can use libiostream without modifying your sources. Use– library=iostream to get this library.
Much of the standard library depends on using standard iostreams. Using classic iostreams in the same program can cause problems.
libC: This is the library needed in compatibility mode (–compat=4). It contains the C++ runtime support as well as the classic iostreams.
libcomplex: This library provides complex arithmetic in compatibility mode (-compat=4). In the standard mode, the complex arithmetic functionality is available in libCstd.
libstlport: This is the STLport implementation of the C++ standard library. You can use this library instead of the default libCstd by specifying the option -library=stlport4. However, you cannot use libstlport and libCstd in the same program. You must compile and link everything, including imported libraries, using one or the other exclusively.
librwtool (Tools.h++): Tools.h++ is a C++ foundation class library from RogueWave. Version 7 of this library is provided with this release. This library is available in classic-iostreams form (-library=rwtools7) and standard-iostreams form (-library=rwtools7_std). For further information about this library, see the following online documentation.
Tools.h++ User’s Guide (Version 7)
Tools.h++ Class Library Reference (Version 7)
You can access this documentation by pointing your web browser to:
file:/opt/SUNWspro/docs/index.html |
If your compiler software is not installed in the /opt directory, ask your system administrator for the equivalent path on your system.
libgc: This library is used in deployment mode or garbage collection mode. Simply linking with the libgc library automatically and permanently fixes a program’s memory leaks. When you link your program with the libgc library, you can program without calling free or delete while otherwise programming normally. The garbage collection library has a dependency on the dynamic load library so specify -lgc and -ldl when you link your program.
Additional information can be found in the gcFixPrematureFrees(3) and gcInitialize(3) man pages.
libdemangle: This library is used for demangling C++ mangled names.
The man pages associated with the libraries described in this section are located in:
/opt/SUNWspro/man/man1
/opt/SUNWspro/man/man3
/opt/SUNWspro/man/man3C++
/opt/SUNWspro/man/man3cc4
If your compiler software is not installed in the /opt directory, ask your system administrator for the equivalent path on your system.
To access these man pages, ensure that your MANPATH includes /opt/SUNWspro/man (or the equivalent path on your system for the compiler software).
To access man pages for the C++ libraries, type:
example% man library-name |
To access man pages for version 4.2 of the C++ libraries, type:
example% man -s 3CC4 library-name |
You can also access the man pages by pointing your browser to:
file:/opt/SUNWspro/docs/index.html |
Some of the C++ libraries are linked by default by the CC driver, while others need to be linked explicitly. In the standard mode, the following libraries are linked by default by the CC driver:
In compatibility mode (-compat), the following libraries are linked by default:
-lC -lm -lc
See A.2.49 -library=l[,l...] for more information.