-B deferred really works but that isnt exactly lazy loading. deferred binding simply means that symbols will be bound when references are encountered during runtime. lazy loading means that a library will be loaded only when a reference to a symbol defined in that library is encountered.
by default the dynamic loader will try to load all the required libraries (recorded in the executable or in required libraries and so on) at the startup of the process and bind symbols at startup. if either the loading or symbol binding fails, the loader terminates the process at startup.
with deferred binding the loader still tries to load the libraries at startup and if that fails, terminates the process at startup. the loader tries to bind the symbol when a reference is encountered and if it fails, terminates the process (which need not be at startup, can be much later).
with lazy loading, the linker records the symbol binding information in the executable or library. the loader then tries to load the library only when it encounters an unbound reference, using the direct bind information for that symbol. another significant difference is that since lazy loading is implemented using direct binding, there is a bias set at link time as to which library will resolve a symbol (no such bias in deferred binding or immediate binding). so the process may run even in the absence of some required shared libraries, depending on what path in the code the running process takes.
lazy loading (and direct binding) were implemented very recently on hpux. get the latest linker/loader patches (PHSS_28869 for 11.00 and PHSS_28871 for 11.11) and check the linker man page ("man ld" and "ld +help" for more information. look for the options '-B lazyload'/'-B direct'/'-B lazydirect'. the explanation is a little too complex, so you better read the documentation.
With big shared libraries, the system will suffer from sudden freezes when something from a lazy loaded library is accessed. It was extremely annoying on the 'slower' machines 10 years ago.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.