From: Jonathan Wakely Copyright ©
+
-The GNU C++ library sources have been specially formatted so that with the
-proper invocation of another tool (Doxygen), a set of HTML pages
-are generated from the sources files themselves. The resultant
-documentation is referred to as Source Level Documentation, and is
-useful for examining the signatures of public member functions for
-the library classes, finding out what is in a particular include
-file, looking at inheritance diagrams, etc.
+ The GNU C++ library sources have been specially formatted so that
+ with the proper invocation of another tool (Doxygen), a set of
+ indexed reference material can generated from the sources files
+ themselves. The resultant documentation is referred to as the API
+ documentation, and is useful for examining the signatures of public
+ member functions for the library classes, finding out what is in a
+ particular include file, looking at inheritance diagrams, etc.
-The source-level documentation for the most recent releases can be
-viewed online:
+ The API documentation, rendered into HTML, can be viewed online:
for the 3.4 release
@@ -39,16 +40,14 @@ viewed online:
(For the main development tree; see the date on the first page.)
-This generated HTML collection, as above, is also available for download in the libstdc++ snapshots directory at
+ The rendered HTML, as above, is also available for download on the
+ gcc.org site in a directory located at
-Documentation for older releases is available for download only, not
-online viewing.
-
-In addition, an initial set of man pages are also available in the
-same place as the HTML collections. Start with C++Intro(3).
+ In addition, a rendered set of man pages are available in the same
+ location specified above. Start with C++Intro(3).
Table of Contents Table of Contents Table of Contents Table of Contents
+ Using LD_LIBRARY_PATH is not always the best solution, Finding Dynamic or Shared
+ Libraries in the manual gives some alternatives.
3.5.
What's libsupc++?
If the only functions from
More information, including how to optionally enable/disable the
- checks, is available
- here.
+ checks, is available in the
+ Diagnostics.
+ chapter of the manual.
6.6.
Program crashes when using library code in a
dynamically-loaded library
@@ -685,7 +689,7 @@
list::size() is O(n)!
See
- the Containers
+ the Containers
chapter.
6.9.
Aw, that's easy to fix!
@@ -869,6 +873,6 @@
   Â
The copy will take O(n) time and the swap is constant time.
- See Shrink-to-fit
+ See Shrink-to-fit
strings for a similar solution for strings.
<URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>
.
You will almost certainly need to use one of the
mirror sites to download
- the tarball. After unpacking, simply load libstdc++-html-*/index.html
+ the tarball. After unpacking, simply load libstdc++-html-*/index.html
into a browser.
ld.so/rtld/dld.so
.
+ libstdc++.a
which you need are language support functions (those listed in
- clause 18 of the
+ clause 18 of the
standard, e.g., new
and
delete
), then try linking against
libsupc++.a
, which is a subset of
@@ -647,8 +650,9 @@
typo, or wrong visibility, or you just plain forgot, etc).
+
The C++ Standard Library has many include files, types defined in those include files, specific named functions, and other behavior. The text of these behaviors, as written in source include files, is called the Application Programing Interface, or API. -
+
Furthermore, C++ source that is compiled into object files is
transformed by the compiler: it arranges objects with specific
alignment and in a particular layout, mangling names according to a
@@ -32,7 +32,7 @@
-fno-exceptions
, but include others: see the complete
list in the GCC manual under the heading Options
for Code Generation Conventions.
-
+
The configure options used when building a specific libstdc++ version may also impact the resulting library ABI. The available configure options, and their impact on the library ABI, are @@ -240,11 +240,11 @@ int main() %g++ hello.cc -o hello.out %ldd hello.out - libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00764000) - libm.so.6 => /lib/tls/libm.so.6 (0x004a8000) - libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x40016000) - libc.so.6 => /lib/tls/libc.so.6 (0x0036d000) - /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000) + libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00764000) + libm.so.6 => /lib/tls/libm.so.6 (0x004a8000) + libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x40016000) + libc.so.6 => /lib/tls/libc.so.6 (0x0036d000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000) %nm hello.out
@@ -273,7 +273,7 @@ class that would otherwise have implicit versions. This will change the way the compiler deals with this class in by-value return statements or parameters: instead of being passing instances of this class in registers, the compiler will be forced to use memory. See this part - of the C++ ABI documentation for further details. + of the C++ ABI documentation for further details.
Separation of interface and implementation
@@ -298,7 +298,7 @@ class in registers, the compiler will be forced to use memory. See wchar_t instantiations, and
includes basic_string
, the locale facets, and the
types in iostreams
.
-
+
In addition, these techniques have the additional benefit that they reduce binary size, which can increase runtime performance.
@@ -329,7 +329,7 @@ standard includes.
Testing the C++ compiler ABI can be done various ways.
- One. Intel ABI checker. + One. Intel ABI checker.
Two. The second is yet unreleased, but has been announced on the gcc @@ -344,16 +344,16 @@ discussed on the gcc mailing lists.
Testing the C++ library ABI can also be done various ways.
-One. -(Brendan Kehoe, Jeff Law suggestion to run 'make check-c++' two ways, +One. +(Brendan Kehoe, Jeff Law suggestion to run 'make check-c++' two ways, one with a new compiler and an old library, and the other with an old compiler and a new library, and look for testsuite regressions)
Details on how to set this kind of test up can be found here: http://gcc.gnu.org/ml/gcc/2002-08/msg00142.html
-Two. -Use the 'make check-abi' rule in the libstdc++ Makefile. +Two. +Use the 'make check-abi' rule in the libstdc++ Makefile.
This is a proactive check the library ABI. Currently, exported symbol names that are either weak or defined are checked against a last known @@ -372,7 +372,7 @@ machinery.
This dataset is insufficient, yet a start. Also needed is a comprehensive check for all user-visible types part of the standard -library for sizeof() and alignof() changes. +library for sizeof() and alignof() changes.
Verifying compatible layouts of objects is not even attempted. It should be possible to use sizeof, alignof, and offsetof to compute @@ -403,7 +403,7 @@ exceptions, locale, etc. %$bld/H-x86-gcc-3.4.0/bin/g++ -c a.cc -%ar cru libone.a a.o +%ar cru libone.a a.o
And, libtwo is constructed as follows:
%$bld/H-x86-gcc-3.3.3/bin/g++ -fPIC -DPIC -c b.cc @@ -413,24 +413,24 @@ exceptions, locale, etc. %$bld/H-x86-gcc-3.3.3/bin/g++ -c b.cc -%ar cru libtwo.a b.o +%ar cru libtwo.a b.o
...with the resulting libraries looking like
%ldd libone.so.1.0.0
- libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40016000)
- libm.so.6 => /lib/tls/libm.so.6 (0x400fa000)
- libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x4011c000)
- libc.so.6 => /lib/tls/libc.so.6 (0x40125000)
- /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
+ libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40016000)
+ libm.so.6 => /lib/tls/libm.so.6 (0x400fa000)
+ libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x4011c000)
+ libc.so.6 => /lib/tls/libc.so.6 (0x40125000)
+ /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
%ldd libtwo.so.1.0.0
- libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40027000)
- libm.so.6 => /lib/tls/libm.so.6 (0x400e1000)
- libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x40103000)
- libc.so.6 => /lib/tls/libc.so.6 (0x4010c000)
- /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
+ libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40027000)
+ libm.so.6 => /lib/tls/libm.so.6 (0x400e1000)
+ libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x40103000)
+ libc.so.6 => /lib/tls/libc.so.6 (0x4010c000)
+ /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
-
+
Then, the "C" compiler is used to compile a source file that uses functions from each library.
@@ -440,18 +440,18 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.%ldd a.out - libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00764000) - libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40015000) - libc.so.6 => /lib/tls/libc.so.6 (0x0036d000) - libm.so.6 => /lib/tls/libm.so.6 (0x004a8000) - libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x400e5000) - /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000) + libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00764000) + libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40015000) + libc.so.6 => /lib/tls/libc.so.6 (0x0036d000) + libm.so.6 => /lib/tls/libm.so.6 (0x004a8000) + libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x400e5000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
This resulting binary, when executed, will be able to safely use code from both liba, and the dependent libstdc++.so.6, and libb, with the dependent libstdc++.so.5. -
Some features in the C++ language make versioning especially difficult. In particular, compiler generated constructs such as implicit instantiations for templates, typeinfo information, and @@ -464,60 +464,71 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so. 24660: versioning weak symbols in libstdc++
19664: libstdc++ headers should have pop/push of the visibility around the declarations -