3. Using the C++ Compiler Options
6. Creating and Using Templates
9. Improving Program Performance
10. Building Multithreaded Programs
12. Using The C++ Standard Library
13. Using the Classic iostream Library
14. Using the Complex Arithmetic Library
15.2 Building Static (Archive) Libraries
15.3 Building Dynamic (Shared) Libraries
15.4 Building Shared Libraries That Contain Exceptions
15.5 Building Libraries for Private Use
15.6 Building Libraries for Public Use
If you want to use dlopen() to open a C++ shared library from a C program, make sure that the shared library has a dependency on the appropriate C++ runtime (libC.so.5 for -compat=4, or libCrun.so.1 for -compat=5).
To do this, add -lC for -compat=4 or add -lCrun for -compat=5 to the command line when building the shared library. For example:
example% CC -G -compat=4... -lC example% CC -G -compat=5... -lCrun
If the shared library uses exceptions and does not have a dependency on the C++ runtime library, your C program might behave erratically.