struct Toupper
{
- Toupper (std::locale const& l) : loc(l) {;}
+ Toupper(std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::toupper(c,loc); }
private:
std::locale const& loc;
struct Tolower
{
- Tolower (std::locale const& l) : loc(l) {;}
+ Tolower(std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::tolower(c,loc); }
private:
std::locale const& loc;
int main ()
{
- std::string s ("Some Kind Of Initial Input Goes Here");
- Toupper up ( std::locale("C") );
- Tolower down ( std::locale("C") );
+ std::string s("Some Kind Of Initial Input Goes Here");
+ std::locale loc_c("C");
+ Toupper up(loc_c);
+ Tolower down(loc_c);
- // Change everything into upper case
- std::transform (s.begin(), s.end(), s.begin(),
- up
- );
+ // Change everything into upper case.
+ std::transform(s.begin(), s.end(), s.begin(), up);
- // Change everything into lower case
- std::transform (s.begin(), s.end(), s.begin(),
- down
- );
+ // Change everything into lower case.
+ std::transform(s.begin(), s.end(), s.begin(), down);
// Change everything back into upper case, but store the
- // result in a different string
+ // result in a different string.
std::string capital_s;
- std::transform (s.begin(), s.end(), std::back_inserter(capital_s),
- up
- );
+ std::transform(s.begin(), s.end(), std::back_inserter(capital_s), up);
}</pre>
</p>
<p>The final version of the code uses <code>bind2nd</code> to eliminate
===========================
-2002-07-23 Benjamin Kosnik
+2002-07-30 Benjamin Kosnik
Description of the libstdc++ ABI.
I. What is an ABI? What's covered? What's not?
+- scope of document, of use to system integrators.
+
- What's the deal with C++? Why can't different compiler's object
files link with each other? Bug? Feature?
-- scope of document, of use to system integrators.
-
- compilation includes and linked library binary must match up..
-- library ABI, compiler ABI different (but effects)
+- shared library only, static is immutable.
+
+- What's an ABI?
+
+- library ABI, compiler ABI different issues, (but related)
- GNU C++ does not have a compiler command line option to switch
between various different C++ ABIs. For instance, there is no way to
the complete list), but there is no version switch. Sorry. The GNU
Project recommends that
-- shared library only, static is immutable.
+- How can this complexity be managed? What does C++ versioning mean?
+ Because library and compiler changes often make binaries compiled
+ with one version of the GNU tools incompatible with binaries
+ compiled with other (either newer or older) versions of the same GNU
+ tools, specific techniques are used to make managing this complexity
+ easier.
+
+ The following techniques are used:
+ - Release versioning on the libgcc_s.so binary.
+
+ - Release versioning on the libstdc++.so binary.
+
+ - Symbol versioning on the libgcc_s.so binary.
+
+ - Symbol versioning on the libstdc++.so binary.
+
+ - Incremental bumping of a compiler pre-defined macro,
+ __GXX_ABI_VERSION. This macro will be automatically defined
+ whenever g++ is used (the curious can test this by invoking g++
+ with the '-v' flag.
+
+ This macro is defined in the file "lang-specs.h" in the gcc/cp directory.
+
+ It is versioned as follows:
+ gcc-3.0.x: 100
+ gcc-3.1.x: 100
+ gcc-3.2.x: 101
+
+ Ask the compiler people why this makes sense, or what this macro means.
+
+ - Incremental bumping of a library pre-defined macro,
+ __GLIBCPP__. This macro is defined as the date the library was
+ released, in compressed ISO date format, as an unsigned long.
+
+ This macro is defined in the file "c++config" in the
+ "libstdc++-v3/include/bits" directory and is changed every night
+ by an automated script.
+
+ It is versioned as follows:
+ gcc-3.0.0: 20010615
+ gcc-3.0.1: 20010819
+ gcc-3.0.2: 20011023
+ gcc-3.0.3: 20011220
+ gcc-3.0.4: 20020220
+ gcc-3.1.0: 20020514
+ gcc-3.1.1: 20020725
+ gcc-3.2.0: (20020731)
+
+ - Incremental bumping of a library pre-defined macro,
+ _GLIBCPP_VERSION. This macro is defined as the released version of
+ the library, as a string literal. This is only implemented in
+ gcc-3.1.0 releases and higher.
+
+ This macro is defined in the file "c++config" in the
+ "libstdc++-v3/include/bits" directory and is generated
+ automatically by autoconf as part of the configure-time generation
+ of config.h.
+
+ It is versioned as follows:
+ gcc-3.0.0: "3.0.0"
+ gcc-3.0.1: "3.0.0"
+ gcc-3.0.2: "3.0.0"
+ gcc-3.0.3: "3.0.0"
+ gcc-3.0.4: "3.0.0"
+ gcc-3.1.0: "3.1.0"
+ gcc-3.1.1: "3.1.1"
+ gcc-3.2.0: ("3.2.0")
+
+ - Matching each specific C++ compiler release to a specific set of
+ C++ include files. This is only implemented in gcc-3.1.1 releases
+ and higher.
+
+ All C++ includes are installed in include/c++, then nest in a
+ directory heirarchy corresponding to the C++ compiler's released
+ version. This version corresponds to the variable "gcc_version" in
+ "libstdc++-v3/acinclude.m4," and more details can be found in that
+ file's macro GLIBCPP_CONFIGURE.
+
+ C++ includes are versioned as follows:
+ gcc-3.0.0: include/g++-v3
+ gcc-3.0.1: include/g++-v3
+ gcc-3.0.2: include/g++-v3
+ gcc-3.0.3: include/g++-v3
+ gcc-3.0.4: include/g++-v3
+ gcc-3.1.0: include/g++-v3
+ gcc-3.1.1: include/c++/3.1.1
+ gcc-3.2.0: include/c++/3.2
+
+ Taken together, these techniques can accurately specify interface
+ and implementation changes in the GNU C++ tools themselves. Used
+ properly, they allow both the GNU C++ tools implementation, and
+ programs using them, an evolving yet controlled development that
+ maintains backward compatibility.
- Minimum environment that supports a versioned ABI: what's needed? A
supported dynamic linker, a GNU linker of sufficient vintage to
U _ZNSt8ios_base4InitC1Ev@@GLIBCPP_3.1
+II. Library ABI changes
+The following will cause the library major version number to
+increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0".
-
-
-II. ABI changes
+- any g++ compiler ABI changes
- (anything) changing size of an exported symbol
- (anything) adding or deleting an exported symbol
+The following will cause the library revision version number to
+increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1".
+
+- any release of the gcc toolchain.
+
III. Versioning