dlsym(3) Library Functions Manual dlsym(3) dlsym, dlvsym - LIBRARY Dynamic linking library (libdl, -ldl) #include void *dlsym(void *restrict handle, const char *restrict symbol); #define _GNU_SOURCE #include void *dlvsym(void *restrict handle, const char *restrict symbol, const char *restrict version); dlsym() <<>> , dlopen(3) ( null ). , . , dlopen(3) , dlsym() NULL (, dlsym(), ). ( ) NULL. NULL, dlsym(), . , NULL, dlerror(3) , dlsym(), dlerror(3), NULL. -, handle: RTLD_DEFAULT , . , , RTLD_GLOBAL. RTLD_NEXT , . , , , ( LD_PRELOAD ld.so(8)) <<>> , (, , <<>> , ). RTLD_DEFAULT RTLD_NEXT , _GNU_SOURCE. dlvsym() dlsym(), . , symbol. NULL; dlerror(3). attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |dlsym(), dlvsym() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ dlsym() POSIX.1-2008. dlvsym() GNU. dlsym() glibc 2.0. POSIX.1-2001. dlvsym() glibc 2.1. There are several scenarios when the address of a global symbol is NULL. For example, a symbol can be placed at zero address by the linker, via a linker script or with --defsym command-line option. Undefined weak symbols also have NULL value. Finally, the symbol value may be the result of a GNU indirect function (IFUNC) resolver function that returns NULL as the resolved value. In the latter case, dlsym() also returns NULL without error. However, in the former two cases, the behavior of GNU dynamic linker is inconsistent: relocation processing succeeds and the symbol can be observed to have NULL value, but dlsym() fails and dlerror() indicates a lookup error. dlsym() dlopen, SunOS. dlvsym(). dlopen(3). . dl_iterate_phdr(3), dladdr(3), dlerror(3), dlinfo(3), dlopen(3), ld.so(8) Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . dlsym(3)