Go to the first, previous, next, last section, table of contents.
Creating libraries of C++ code is a fairly straightforward process, and
differs from C code in only two ways:
-
Because of name mangling, C++ libraries are only usable by the C++
compiler that created them. This decision was made by the designers of
C++ in order to protect users from conflicting implementations of
features such as constructors, exception handling, and RTTI.
-
On some systems, notably SunOS 4, the dynamic linker does not call
non-constant initializers. This can lead to hard-to-pinpoint bugs in
your library. GCC 2.7 and later versions work around this problem, but
previous versions and other compilers do not.
This second issue is very complex. Basically, you should avoid any
global or static variable initializations that would cause an
"initializer element is not constant" error if you compiled them with
a standard C compiler.
There are other ways of working around this problem, but they are beyond
the scope of this manual.
Go to the first, previous, next, last section, table of contents.