324_Book

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: erver dynamically loads and links the appropriate function and then calls it directly, as opposed to using fork and execve to run the function in the context of a child process. The function remains in the server’s address space, so subsequent requests can be handled at the cost of a simple function call. This can have a significant impact on the throughput of a busy site. Further, existing functions can be updated and new functions can be added at run-time, without stopping the server. Linux and Solaris systems provide a simple interface to the dynamic linker that allows application programs to load and link shared libraries at run time. #include <dlfcn.h> void *dlopen(const char *filename, int flag); returns: ptr to handle if OK, NULL on error 7.12. *POSITION-INDEPENDENT CODE (PIC) 377 The dlopen function loads and links the shared library filename. The external symbols in filename are resolved using libraries previously opened with the RTLD GLOBAL flag. If the current executable was compiled with the -rdynamic flag, then its global symbols are also available for symbol resolution. The flag argument must include either RTLD NOW, which tells the linker to resolve references to external symbols immediately, or the RTLD LAZY flag, which instructs the linker to defer symbol resolution until code from the l...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online