logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

dlopen.3p (9805B)


  1. '\" et
  2. .TH DLOPEN "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. dlopen
  12. \(em open a symbol table handle
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <dlfcn.h>
  17. .P
  18. void *dlopen(const char *\fIfile\fP, int \fImode\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIdlopen\fR()
  23. function shall make the symbols (function identifiers and data object
  24. identifiers) in the executable object file specified by
  25. .IR file
  26. available to the calling program.
  27. .P
  28. The class of executable object files eligible for this operation and
  29. the manner of their construction are implementation-defined, though
  30. typically such files are shared libraries or programs.
  31. .P
  32. Implementations may permit the construction of embedded dependencies in
  33. executable object files. In such cases, a
  34. \fIdlopen\fR()
  35. operation shall load those dependencies in addition to the executable
  36. object file specified by
  37. .IR file .
  38. Implementations may also impose specific constraints on the construction
  39. of programs that can employ
  40. \fIdlopen\fR()
  41. and its related services.
  42. .P
  43. A successful
  44. \fIdlopen\fR()
  45. shall return a symbol table handle which the caller may use on subsequent
  46. calls to
  47. \fIdlsym\fR()
  48. and
  49. \fIdlclose\fR().
  50. .P
  51. The value of this symbol table handle should not be interpreted in any
  52. way by the caller.
  53. .P
  54. The
  55. .IR file
  56. argument is used to construct a pathname to the executable object file. If
  57. .IR file
  58. contains a
  59. <slash>
  60. character, the
  61. .IR file
  62. argument is used as the pathname for the file. Otherwise,
  63. .IR file
  64. is used in an implementation-defined manner to yield a pathname.
  65. .P
  66. If
  67. .IR file
  68. is a null pointer,
  69. \fIdlopen\fR()
  70. shall return a global symbol table handle for the currently running
  71. process image. This symbol table handle shall provide access to the
  72. symbols from an ordered set of executable object files consisting of
  73. the original program image file, any executable object files loaded
  74. at program start-up as specified by that process file (for example,
  75. shared libraries), and the set of executable object files loaded using
  76. \fIdlopen\fR()
  77. operations with the RTLD_GLOBAL flag. As the latter set of executable
  78. object files can change during execution, the set of symbols made
  79. available by this symbol table handle can also change dynamically.
  80. .P
  81. Only a single copy of an executable object file shall be brought into
  82. the address space, even if
  83. \fIdlopen\fR()
  84. is invoked multiple times in reference to the executable object file,
  85. and even if different pathnames are used to reference the executable
  86. object file.
  87. .P
  88. The
  89. .IR mode
  90. parameter describes how
  91. \fIdlopen\fR()
  92. shall operate upon
  93. .IR file
  94. with respect to the processing of relocations and the scope of visibility
  95. of the symbols provided within
  96. .IR file .
  97. When an executable object file is brought into the address space of a
  98. process, it may contain references to symbols whose addresses are not
  99. known until the executable object file is loaded.
  100. .P
  101. These references shall be relocated before the symbols can be accessed. The
  102. .IR mode
  103. parameter governs when these relocations take place and may have the
  104. following values:
  105. .IP RTLD_LAZY 12
  106. Relocations shall be performed at an implementation-defined time,
  107. ranging from the time of the
  108. \fIdlopen\fR()
  109. call until the first reference to a given symbol occurs. Specifying
  110. RTLD_LAZY should improve performance on implementations supporting dynamic
  111. symbol binding since a process might not reference all of the symbols
  112. in an executable object file. And, for systems supporting dynamic symbol
  113. resolution for normal process execution, this behavior mimics the normal
  114. handling of process execution.
  115. .IP RTLD_NOW 12
  116. All necessary relocations shall be performed when the executable object
  117. file is first loaded. This may waste some processing if relocations are
  118. performed for symbols that are never referenced. This behavior may be
  119. useful for applications that need to know that all symbols referenced
  120. during execution will be available before
  121. \fIdlopen\fR()
  122. returns.
  123. .P
  124. Any executable object file loaded by
  125. \fIdlopen\fR()
  126. that requires relocations against global symbols can reference the symbols
  127. in the original process image file, any executable object files loaded
  128. at program start-up, from the initial process image itself, from any
  129. other executable object file included in the same
  130. \fIdlopen\fR()
  131. invocation, and any executable object files that were loaded in any
  132. \fIdlopen\fR()
  133. invocation and which specified the RTLD_GLOBAL flag. To determine the
  134. scope of visibility for the symbols loaded with a
  135. \fIdlopen\fR()
  136. invocation, the
  137. .IR mode
  138. parameter should be a bitwise-inclusive OR with one of the following
  139. values:
  140. .IP RTLD_GLOBAL 12
  141. The executable object file's symbols shall be made available for
  142. relocation processing of any other executable object file. In addition,
  143. symbol lookup using
  144. .IR dlopen (NULL, mode )
  145. and an associated
  146. \fIdlsym\fR()
  147. allows executable object files loaded with this mode to be searched.
  148. .IP RTLD_LOCAL 12
  149. The executable object file's symbols shall not be made available for
  150. relocation processing of any other executable object file.
  151. .P
  152. If neither RTLD_GLOBAL nor RTLD_LOCAL is specified, the default behavior
  153. is unspecified.
  154. .P
  155. If an executable object file is specified in multiple
  156. \fIdlopen\fR()
  157. invocations,
  158. .IR mode
  159. is interpreted at each invocation.
  160. .P
  161. If RTLD_NOW has been specified, all relocations shall have been completed
  162. rendering further RTLD_NOW operations redundant and any further RTLD_LAZY
  163. operations irrelevant.
  164. .P
  165. If RTLD_GLOBAL has been specified, the executable object file shall
  166. maintain the RTLD_GLOBAL status regardless of any previous or future
  167. specification of RTLD_LOCAL, as long as the executable object file
  168. remains in the address space (see
  169. .IR "\fIdlclose\fR\^(\|)").
  170. .P
  171. Symbols introduced into the process image through calls to
  172. \fIdlopen\fR()
  173. may be used in relocation activities. Symbols so introduced may duplicate
  174. symbols already defined by the program or previous
  175. \fIdlopen\fR()
  176. operations. To resolve the ambiguities such a situation might present,
  177. the resolution of a symbol reference to symbol definition is based on a
  178. symbol resolution order. Two such resolution orders are defined: load
  179. order and dependency order. Load order establishes an ordering among
  180. symbol definitions, such that the first definition loaded (including
  181. definitions from the process image file and any dependent executable
  182. object files loaded with it) has priority over executable object files
  183. added later (by
  184. \fIdlopen\fR()).
  185. Load ordering is used in relocation processing. Dependency ordering uses
  186. a breadth-first order starting with a given executable object file,
  187. then all of its dependencies, then any dependents of those, iterating
  188. until all dependencies are satisfied. With the exception of the global
  189. symbol table handle obtained via a
  190. \fIdlopen\fR()
  191. operation with a null pointer as the
  192. .IR file
  193. argument, dependency ordering is used by the
  194. \fIdlsym\fR()
  195. function. Load ordering is used in
  196. \fIdlsym\fR()
  197. operations upon the global symbol table handle.
  198. .P
  199. When an executable object file is first made accessible via
  200. \fIdlopen\fR(),
  201. it and its dependent executable object files are added in dependency
  202. order. Once all the executable object files are added, relocations are
  203. performed using load order. Note that if an executable object file or
  204. its dependencies had been previously loaded, the load and dependency
  205. orders may yield different resolutions.
  206. .P
  207. The symbols introduced by
  208. \fIdlopen\fR()
  209. operations and available through
  210. \fIdlsym\fR()
  211. are at a minimum those which are exported as identifiers of global
  212. scope by the executable object file. Typically, such identifiers shall
  213. be those that were specified in (for example) C source code as having
  214. .BR extern
  215. linkage. The precise manner in which an implementation constructs
  216. the set of exported symbols for an executable object file is
  217. implementation-defined.
  218. .SH "RETURN VALUE"
  219. Upon successful completion,
  220. \fIdlopen\fR()
  221. shall return a symbol table handle. If
  222. .IR file
  223. cannot be found, cannot be opened for reading, is not of an appropriate
  224. executable object file format for processing by
  225. \fIdlopen\fR(),
  226. or if an error occurs during the process of loading
  227. .IR file
  228. or relocating its symbolic references,
  229. \fIdlopen\fR()
  230. shall return a null pointer. More detailed diagnostic information shall
  231. be available through
  232. \fIdlerror\fR().
  233. .SH ERRORS
  234. No errors are defined.
  235. .LP
  236. .IR "The following sections are informative."
  237. .SH EXAMPLES
  238. Refer to
  239. .IR "\fIdlsym\fR\^(\|)".
  240. .SH "APPLICATION USAGE"
  241. None.
  242. .SH RATIONALE
  243. None.
  244. .SH "FUTURE DIRECTIONS"
  245. None.
  246. .SH "SEE ALSO"
  247. .IR "\fIdlclose\fR\^(\|)",
  248. .IR "\fIdlerror\fR\^(\|)",
  249. .IR "\fIdlsym\fR\^(\|)"
  250. .P
  251. The Base Definitions volume of POSIX.1\(hy2017,
  252. .IR "\fB<dlfcn.h>\fP"
  253. .\"
  254. .SH COPYRIGHT
  255. Portions of this text are reprinted and reproduced in electronic form
  256. from IEEE Std 1003.1-2017, Standard for Information Technology
  257. -- Portable Operating System Interface (POSIX), The Open Group Base
  258. Specifications Issue 7, 2018 Edition,
  259. Copyright (C) 2018 by the Institute of
  260. Electrical and Electronics Engineers, Inc and The Open Group.
  261. In the event of any discrepancy between this version and the original IEEE and
  262. The Open Group Standard, the original IEEE and The Open Group Standard
  263. is the referee document. The original Standard can be obtained online at
  264. http://www.opengroup.org/unix/online.html .
  265. .PP
  266. Any typographical or formatting errors that appear
  267. in this page are most likely
  268. to have been introduced during the conversion of the source files to
  269. man page format. To report such errors, see
  270. https://www.kernel.org/doc/man-pages/reporting_bugs.html .