1DLCLOSE(3P)                POSIX Programmer's Manual               DLCLOSE(3P)
2
3
4

PROLOG

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
11

NAME

13       dlclose — close a symbol table handle
14

SYNOPSIS

16       #include <dlfcn.h>
17
18       int dlclose(void *handle);
19

DESCRIPTION

21       The dlclose() function shall inform the system that  the  symbol  table
22       handle specified by handle is no longer needed by the application.
23
24       An  application  writer may use dlclose() to make a statement of intent
25       on the part of the process, but this  statement  does  not  create  any
26       requirement  upon  the  implementation. When the symbol table handle is
27       closed, the implementation may unload the executable object files  that
28       were  loaded  by  dlopen()  when the symbol table handle was opened and
29       those that were loaded by dlsym() when using the  symbol  table  handle
30       identified by handle.
31
32       Once  a  symbol  table  handle  has  been closed, an application should
33       assume that any symbols (function identifiers and data  object  identi‐
34       fiers)  made  visible  using  handle,  are  no  longer available to the
35       process.
36
37       Although a dlclose() operation is not required to remove any  functions
38       or  data  objects  from the address space, neither is an implementation
39       prohibited from doing so. The only restriction on  such  a  removal  is
40       that  no  function nor data object shall be removed to which references
41       have been relocated, until or unless all such references  are  removed.
42       For  instance,  an  executable  object file that had been loaded with a
43       dlopen() operation specifying the RTLD_GLOBAL flag might provide a tar‐
44       get  for dynamic relocations performed in the processing of other relo‐
45       catable objects—in such environments, an application may assume that no
46       relocation,  once made, shall be undone or remade unless the executable
47       object file containing the relocated object has itself been removed.
48

RETURN VALUE

50       If  the  referenced  symbol  table  handle  was  successfully   closed,
51       dlclose()  shall  return  0. If handle does not refer to an open symbol
52       table handle or if  the  symbol  table  handle  could  not  be  closed,
53       dlclose()  shall  return  a  non-zero  value.  More detailed diagnostic
54       information shall be available through dlerror().
55

ERRORS

57       No errors are defined.
58
59       The following sections are informative.
60

EXAMPLES

62       The following example illustrates use of dlopen() and dlclose():
63
64           #include <dlfcn.h>
65           int eret;
66           void *mylib;
67           ...
68           /* Open a dynamic library and then close it ... */
69           mylib = dlopen("mylib.so", RTLD_LOCAL | RTLD_LAZY);
70           ...
71           eret = dlclose(mylib);
72           ...
73

APPLICATION USAGE

75       A conforming application should employ a symbol table  handle  returned
76       from  a  dlopen()  invocation  only within a given scope bracketed by a
77       dlopen() operation and the corresponding dlclose() operation. Implemen‐
78       tations  are  free  to  use reference counting or other techniques such
79       that multiple calls to dlopen() referencing the same executable  object
80       file  may  return a pointer to the same data object as the symbol table
81       handle.
82
83       Implementations are also free to re-use a handle.  For  these  reasons,
84       the  value  of  a  handle must be treated as an opaque data type by the
85       application, used only in calls to dlsym() and dlclose().
86

RATIONALE

88       None.
89

FUTURE DIRECTIONS

91       None.
92

SEE ALSO

94       dlerror(), dlopen(), dlsym()
95
96       The Base Definitions volume of POSIX.1‐2008, <dlfcn.h>
97
99       Portions of this text are reprinted and reproduced in  electronic  form
100       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
101       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
102       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
103       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
104       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
105       event of any discrepancy between this version and the original IEEE and
106       The  Open Group Standard, the original IEEE and The Open Group Standard
107       is the referee document. The original Standard can be  obtained  online
108       at http://www.unix.org/online.html .
109
110       Any  typographical  or  formatting  errors that appear in this page are
111       most likely to have been introduced during the conversion of the source
112       files  to  man page format. To report such errors, see https://www.ker
113       nel.org/doc/man-pages/reporting_bugs.html .
114
115
116
117IEEE/The Open Group                  2013                          DLCLOSE(3P)
Impressum