diff options
Diffstat (limited to 'man3/dlopen.3')
-rw-r--r-- | man3/dlopen.3 | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/man3/dlopen.3 b/man3/dlopen.3 index cf1ad4384..3774e9ebc 100644 --- a/man3/dlopen.3 +++ b/man3/dlopen.3 @@ -14,7 +14,7 @@ .\" Modified by Walter Harms: dladdr, dlvsym .\" Modified by Petr Baudis <pasky@suse.cz>, 2008-12-04: dladdr caveat .\" -.TH dlopen 3 2023-02-05 "Linux man-pages 6.03" +.TH dlopen 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME dlclose, dlopen, dlmopen \- open and close a shared object @@ -346,48 +346,49 @@ returns 0; on error, it returns a nonzero value. .PP Errors from these functions can be diagnosed using .BR dlerror (3). -.SH VERSIONS -.BR dlopen () -and -.BR dlclose () -are present in glibc 2.0 and later. -.BR dlmopen () -first appeared in glibc 2.3.4. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR dlopen (), .BR dlmopen (), .BR dlclose () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 .SH STANDARDS -POSIX.1-2001 describes +.TP +.BR dlopen () +.TQ .BR dlclose () -and -.BR dlopen (). -The +POSIX.1-2008. +.TP .BR dlmopen () -function is a GNU extension. -.PP -The -.BR RTLD_NOLOAD , -.BR RTLD_NODELETE , -and +.TQ +.B RTLD_NOLOAD +.TQ +.B RTLD_NODELETE +GNU. +.TP .B RTLD_DEEPBIND -flags are GNU extensions; -the first two of these flags are also present on Solaris. +Solaris. +.SH HISTORY +.TP +.BR dlopen () +.TQ +.BR dlclose () +glibc 2.0. +POSIX.1-2001. +.TP +.BR dlmopen () +glibc 2.3.4. .SH NOTES .SS dlmopen() and namespaces A link-map list defines an isolated namespace for the @@ -557,7 +558,7 @@ $ \fB./a.out\fP #include <dlfcn.h> #include <stdio.h> #include <stdlib.h> - +\& #include <gnu/lib\-names.h> /* Defines LIBM_SO (which will be a string such as "libm.so.6") */ int @@ -566,27 +567,27 @@ main(void) void *handle; double (*cosine)(double); char *error; - +\& handle = dlopen(LIBM_SO, RTLD_LAZY); if (!handle) { fprintf(stderr, "%s\en", dlerror()); exit(EXIT_FAILURE); } - +\& dlerror(); /* Clear any existing error */ - +\& cosine = (double (*)(double)) dlsym(handle, "cos"); - +\& /* According to the ISO C standard, casting between function pointers and \[aq]void *\[aq], as done above, produces undefined results. POSIX.1\-2001 and POSIX.1\-2008 accepted this state of affairs and proposed the following workaround: - +\& *(void **) (&cosine) = dlsym(handle, "cos"); - +\& This (clumsy) cast conforms with the ISO C standard and will avoid any compiler warnings. - +\& The 2013 Technical Corrigendum 1 to POSIX.1\-2008 improved matters by requiring that conforming implementations support casting \[aq]void *\[aq] to a function pointer. Nevertheless, some compilers @@ -595,13 +596,13 @@ main(void) .\" http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08 .\" http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07 .\" http://austingroupbugs.net/view.php?id=74 - +\& error = dlerror(); if (error != NULL) { fprintf(stderr, "%s\en", error); exit(EXIT_FAILURE); } - +\& printf("%f\en", (*cosine)(2.0)); dlclose(handle); exit(EXIT_SUCCESS); |