libtool: C++ libraries

1 
1 6.1 Writing libraries for C++
1 =============================
1 
1 Creating libraries of C++ code should be a fairly straightforward
1 process, because its object files differ from C ones in only three ways:
1 
1   1. Because of name mangling, C++ libraries are only usable by the C++
1      compiler that created them.  This decision was made by the
1      designers of C++ to protect users from conflicting implementations
1      of features such as constructors, exception handling, and RTTI.
1 
1   2. On some systems, the C++ compiler must take special actions for the
1      dynamic linker to run dynamic (i.e., run-time) initializers.  This
1      means that we should not call 'ld' directly to link such libraries,
1      and we should use the C++ compiler instead.
1 
1   3. C++ compilers will link some Standard C++ library in by default,
1      but libtool does not know what these libraries are, so it cannot
1      even run the inter-library dependence analyzer to check how to link
1      it in.  Therefore, running 'ld' to link a C++ program or library is
1      deemed to fail.
1 
1    Because of these three issues, Libtool has been designed to always
1 use the C++ compiler to compile and link C++ programs and libraries.  In
1 some instances the 'main()' function of a program must also be compiled
1 with the C++ compiler for static C++ objects to be properly initialized.
1