Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LAZY Loading on HP UNIX???

Status
Not open for further replies.

vsrraman

Programmer
Nov 28, 2003
2
US
Hi,

Is these any equivalent of LAZYLOADING option (which optionally loads the libraries on SUN-SOLARIS) on HP-UX ??

I tried using -Bdeferred but does that really work ???

Thanx in adv,
VSR
 
-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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top