Text section of relocatable object le 1 2 3 4

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: ibrary is executed. Either of these values can be or’d with the RTLD GLOBAL flag. #include <dlfcn.h> void *dlsym(void *handle, char *symbol); returns: ptr to symbol if OK, NULL on error The dlsym function takes a handle to a previously opened shared library and a symbol name, and returns the address of the symbol, if it exists, or NULL otherwise. #include <dlfcn.h> int dlclose (void *handle); returns: 0 if OK, -1 on error The dlclose function unloads the shared library if no other shared libraries are still using it. #include <dlfcn.h> const char *dlerror(void); returns: error msg if previous call to dlopen, dlsym, or dlclose failed, NULL if previous call was OK The dlerror function returns a string describing the most recent error that occurred as a result of calling dlopen, dlsym, or dlclose, or NULL if no error occurred. Figure 7.16 shows how we would use this interface to dynamically link our libvector.so shared library (Figure 7.5), and then invoke its addvec routine. To compile the...
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