1DLERROR(3P) POSIX Programmer's Manual DLERROR(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 dlerror — get diagnostic information
13
15 #include <dlfcn.h>
16
17 char *dlerror(void);
18
20 The dlerror() function shall return a null-terminated character string
21 (with no trailing <newline>) that describes the last error that
22 occurred during dynamic linking processing. If no dynamic linking
23 errors have occurred since the last invocation of dlerror(), dlerror()
24 shall return NULL. Thus, invoking dlerror() a second time, immediately
25 following a prior invocation, shall result in NULL being returned.
26
27 It is implementation-defined whether or not the dlerror() function is
28 thread-safe. A thread-safe implementation shall return only errors that
29 occur on the current thread.
30
32 If successful, dlerror() shall return a null-terminated character
33 string; otherwise, NULL shall be returned.
34
35 The application shall not modify the string returned. The returned
36 pointer might be invalidated or the string content might be overwritten
37 by a subsequent call to dlerror() in the same thread (if dlerror() is
38 thread-safe) or in any thread (if dlerror() is not thread-safe). The
39 returned pointer might also be invalidated if the calling thread is
40 terminated.
41
43 No errors are defined.
44
45 The following sections are informative.
46
48 The following example prints out the last dynamic linking error:
49
50
51 ...
52 #include <dlfcn.h>
53
54 char *errstr;
55
56 errstr = dlerror();
57 if (errstr != NULL)
58 printf ("A dynamic linking error occurred: (%s)\n", errstr);
59 ...
60
62 Depending on the application environment with respect to asynchronous
63 execution events, such as signals or other asynchronous computation
64 sharing the address space, conforming applications should use a criti‐
65 cal section to retrieve the error pointer and buffer.
66
68 None.
69
71 None.
72
74 dlclose(), dlopen(), dlsym()
75
76 The Base Definitions volume of POSIX.1‐2017, <dlfcn.h>
77
79 Portions of this text are reprinted and reproduced in electronic form
80 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
81 table Operating System Interface (POSIX), The Open Group Base Specifi‐
82 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
83 Electrical and Electronics Engineers, Inc and The Open Group. In the
84 event of any discrepancy between this version and the original IEEE and
85 The Open Group Standard, the original IEEE and The Open Group Standard
86 is the referee document. The original Standard can be obtained online
87 at http://www.opengroup.org/unix/online.html .
88
89 Any typographical or formatting errors that appear in this page are
90 most likely to have been introduced during the conversion of the source
91 files to man page format. To report such errors, see https://www.ker‐
92 nel.org/doc/man-pages/reporting_bugs.html .
93
94
95
96IEEE/The Open Group 2017 DLERROR(3P)