If you want to programmatically control the loading and initialization
of C++ objects contained in shared libraries, you can use two functions provided
by
XL C/C++:
loadAndInit and
terminateAndUnload.
These functions are declared in the header file
load.h, and
you can call them from the main program to load, initialize, terminate, and
unload any named shared library. These functions work in the same way, take
the same parameters, and return the same values and error codes as the AIX®
load and
unload routines,
respectively, but they additionally perform initialization of C++ objects.
See the
load and
unload routines in the
Technical Reference: Base Operating System
and Extensions, Volumes 1 & 2 for
more information.
Note: For portability, you might wish to use the POSIX dlopen and dlclose functions,
which also perform initialization and termination, and interact correctly
with loadAndInit and terminateAndUnload.
For more information on dlopen and dlclose,
see the Technical Reference: Base Operating System
and Extensions, Volumes 1 & 2.