Debian Codegraph @

templates/man3/dlopen.3.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:22+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "dlopen"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "dlclose, dlopen, dlmopen - open and close a shared object"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Dynamic linking library (I<libdl>,\\ I<-ldl>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>dlfcn.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
81 #: opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<void *dlopen(const char *>I<path>B<, int >I<flags>B<);>\n"
85 "B<int dlclose(void *>I<handle>B<);>\n"
86 msgstr ""
87
88 #. type: Plain text
89 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
90 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
91 #, no-wrap
92 msgid "B<#define _GNU_SOURCE>\n"
93 msgstr ""
94
95 #. type: Plain text
96 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
97 #: opensuse-tumbleweed
98 #, no-wrap
99 msgid "B<void *dlmopen(Lmid_t >I<lmid>B<, const char *>I<path>B<, int >I<flags>B<);>\n"
100 msgstr ""
101
102 #. type: SH
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 #, no-wrap
106 msgid "DESCRIPTION"
107 msgstr ""
108
109 #. type: SS
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 #, no-wrap
113 msgid "dlopen()"
114 msgstr ""
115
116 #. type: Plain text
117 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
118 #: opensuse-tumbleweed
119 msgid ""
120 "The function B<dlopen>() loads the dynamic shared object (shared library) "
121 "file named by the null-terminated string I<path> and returns an opaque "
122 "\"handle\" for the loaded object. This handle is employed with other "
123 "functions in the dlopen API, such as B<dlsym>(3), B<dladdr>(3), "
124 "B<dlinfo>(3), and B<dlclose>()."
125 msgstr ""
126
127 #. FIXME On Solaris, when handle is NULL, we seem to get back
128 #. a handle for (something like) the root of the namespace.
129 #. The point here is that if we do a dlmopen(LM_ID_NEWLM), then
130 #. the path==NULL case returns a different handle than
131 #. in the initial namespace. But, on glibc, the same handle is
132 #. returned. This is probably a bug in glibc.
133 #. type: Plain text
134 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
135 #: opensuse-tumbleweed
136 msgid ""
137 "If I<path> is NULL, then the returned handle is for the main program. If "
138 "I<path> contains a slash (\"/\"), then it is interpreted as a (relative or "
139 "absolute) pathname. Otherwise, the dynamic linker searches for the object "
140 "as follows (see B<ld.so>(8) for further details):"
141 msgstr ""
142
143 #. type: IP
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 #, no-wrap
147 msgid "\\[bu]"
148 msgstr ""
149
150 #. type: Plain text
151 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
152 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
153 msgid ""
154 "(ELF only) If the calling object (i.e., the shared library or executable "
155 "from which B<dlopen>() is called) contains a DT_RPATH tag, and does not "
156 "contain a DT_RUNPATH tag, then the directories listed in the DT_RPATH tag "
157 "are searched."
158 msgstr ""
159
160 #. type: Plain text
161 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
162 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
163 msgid ""
164 "If, at the time that the program was started, the environment variable "
165 "B<LD_LIBRARY_PATH> was defined to contain a colon-separated list of "
166 "directories, then these are searched. (As a security measure, this variable "
167 "is ignored for set-user-ID and set-group-ID programs.)"
168 msgstr ""
169
170 #. type: Plain text
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 msgid ""
174 "(ELF only) If the calling object contains a DT_RUNPATH tag, then the "
175 "directories listed in that tag are searched."
176 msgstr ""
177
178 #. type: Plain text
179 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
180 #: opensuse-tumbleweed
181 msgid ""
182 "The cache file I</etc/ld.so.cache> (maintained by B<ldconfig>(8)) is "
183 "checked to see whether it contains an entry for I<path>."
184 msgstr ""
185
186 #. type: Plain text
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 msgid "The directories I</lib> and I</usr/lib> are searched (in that order)."
190 msgstr ""
191
192 #. type: Plain text
193 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
194 #: opensuse-tumbleweed
195 msgid ""
196 "If the object specified by I<path> has dependencies on other shared objects, "
197 "then these are also automatically loaded by the dynamic linker using the "
198 "same rules. (This process may occur recursively, if those objects in turn "
199 "have dependencies, and so on.)"
200 msgstr ""
201
202 #. type: Plain text
203 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
204 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
205 msgid "One of the following two values must be included in I<flags>:"
206 msgstr ""
207
208 #. type: TP
209 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
210 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
211 #, no-wrap
212 msgid "B<RTLD_LAZY>"
213 msgstr ""
214
215 #. commit 12b5b6b7f78ea111e89bbf638294a5413c791072
216 #. type: Plain text
217 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
218 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
219 msgid ""
220 "Perform lazy binding. Resolve symbols only as the code that references them "
221 "is executed. If the symbol is never referenced, then it is never resolved. "
222 "(Lazy binding is performed only for function references; references to "
223 "variables are always immediately bound when the shared object is loaded.) "
224 "Since glibc 2.1.1, this flag is overridden by the effect of the "
225 "B<LD_BIND_NOW> environment variable."
226 msgstr ""
227
228 #. type: TP
229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
231 #, no-wrap
232 msgid "B<RTLD_NOW>"
233 msgstr ""
234
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid ""
239 "If this value is specified, or the environment variable B<LD_BIND_NOW> is "
240 "set to a nonempty string, all undefined symbols in the shared object are "
241 "resolved before B<dlopen>() returns. If this cannot be done, an error is "
242 "returned."
243 msgstr ""
244
245 #. type: Plain text
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 msgid "Zero or more of the following values may also be ORed in I<flags>:"
249 msgstr ""
250
251 #. type: TP
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 #, no-wrap
255 msgid "B<RTLD_GLOBAL>"
256 msgstr ""
257
258 #. type: Plain text
259 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
260 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
261 msgid ""
262 "The symbols defined by this shared object will be made available for symbol "
263 "resolution of subsequently loaded shared objects."
264 msgstr ""
265
266 #. type: TP
267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
269 #, no-wrap
270 msgid "B<RTLD_LOCAL>"
271 msgstr ""
272
273 #. type: Plain text
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 msgid ""
277 "This is the converse of B<RTLD_GLOBAL>, and the default if neither flag is "
278 "specified. Symbols defined in this shared object are not made available to "
279 "resolve references in subsequently loaded shared objects."
280 msgstr ""
281
282 #. type: TP
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 #, no-wrap
286 msgid "B<RTLD_NODELETE> (since glibc 2.2)"
287 msgstr ""
288
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 msgid ""
293 "Do not unload the shared object during B<dlclose>(). Consequently, the "
294 "object's static and global variables are not reinitialized if the object is "
295 "reloaded with B<dlopen>() at a later time."
296 msgstr ""
297
298 #. type: TP
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 #, no-wrap
302 msgid "B<RTLD_NOLOAD> (since glibc 2.2)"
303 msgstr ""
304
305 #. type: Plain text
306 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
307 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
308 msgid ""
309 "Don't load the shared object. This can be used to test if the object is "
310 "already resident (B<dlopen>() returns NULL if it is not, or the object's "
311 "handle if it is resident). This flag can also be used to promote the flags "
312 "on a shared object that is already loaded. For example, a shared object "
313 "that was previously loaded with B<RTLD_LOCAL> can be reopened with "
314 "B<RTLD_NOLOAD\\ |\\ RTLD_GLOBAL>."
315 msgstr ""
316
317 #. type: TP
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid "B<RTLD_DEEPBIND> (since glibc 2.3.4)"
322 msgstr ""
323
324 #. Inimitably described by UD in
325 #. http://sources.redhat.com/ml/libc-hacker/2004-09/msg00083.html.
326 #. type: Plain text
327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
329 msgid ""
330 "Place the lookup scope of the symbols in this shared object ahead of the "
331 "global scope. This means that a self-contained object will use its own "
332 "symbols in preference to global symbols with the same name contained in "
333 "objects that have already been loaded."
334 msgstr ""
335
336 #. type: Plain text
337 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
338 #: opensuse-tumbleweed
339 msgid ""
340 "If I<path> is NULL, then the returned handle is for the main program. When "
341 "given to B<dlsym>(3), this handle causes a search for a symbol in the main "
342 "program, followed by all shared objects loaded at program startup, and then "
343 "all shared objects loaded by B<dlopen>() with the flag B<RTLD_GLOBAL>."
344 msgstr ""
345
346 #. type: Plain text
347 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
348 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
349 msgid ""
350 "Symbol references in the shared object are resolved using (in order): "
351 "symbols in the link map of objects loaded for the main program and its "
352 "dependencies; symbols in shared objects (and their dependencies) that were "
353 "previously opened with B<dlopen>() using the B<RTLD_GLOBAL> flag; and "
354 "definitions in the shared object itself (and any dependencies that were "
355 "loaded for that object)."
356 msgstr ""
357
358 #. type: Plain text
359 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
360 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
361 msgid ""
362 "Any global symbols in the executable that were placed into its dynamic "
363 "symbol table by B<ld>(1) can also be used to resolve references in a "
364 "dynamically loaded shared object. Symbols may be placed in the dynamic "
365 "symbol table either because the executable was linked with the flag \"-"
366 "rdynamic\" (or, synonymously, \"--export-dynamic\"), which causes all of the "
367 "executable's global symbols to be placed in the dynamic symbol table, or "
368 "because B<ld>(1) noted a dependency on a symbol in another object during "
369 "static linking."
370 msgstr ""
371
372 #. type: Plain text
373 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
374 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
375 msgid ""
376 "If the same shared object is opened again with B<dlopen>(), the same object "
377 "handle is returned. The dynamic linker maintains reference counts for "
378 "object handles, so a dynamically loaded shared object is not deallocated "
379 "until B<dlclose>() has been called on it as many times as B<dlopen>() has "
380 "succeeded on it. Constructors (see below) are called only when the object "
381 "is actually loaded into memory (i.e., when the reference count increases to "
382 "1)."
383 msgstr ""
384
385 #. type: Plain text
386 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
387 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
388 msgid ""
389 "A subsequent B<dlopen>() call that loads the same shared object with "
390 "B<RTLD_NOW> may force symbol resolution for a shared object earlier loaded "
391 "with B<RTLD_LAZY>. Similarly, an object that was previously opened with "
392 "B<RTLD_LOCAL> can be promoted to B<RTLD_GLOBAL> in a subsequent B<dlopen>()."
393 msgstr ""
394
395 #. type: Plain text
396 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
397 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
398 msgid "If B<dlopen>() fails for any reason, it returns NULL."
399 msgstr ""
400
401 #. type: SS
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 #, no-wrap
405 msgid "dlmopen()"
406 msgstr ""
407
408 #. type: Plain text
409 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
410 #: opensuse-tumbleweed
411 msgid ""
412 "This function performs the same task as B<dlopen>()\\[em]the I<path> and "
413 "I<flags> arguments, as well as the return value, are the same, except for "
414 "the differences noted below."
415 msgstr ""
416
417 #. type: Plain text
418 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
419 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
420 msgid ""
421 "The B<dlmopen>() function differs from B<dlopen>() primarily in that it "
422 "accepts an additional argument, I<lmid>, that specifies the link-map list "
423 "(also referred to as a I<namespace>) in which the shared object should be "
424 "loaded. (By comparison, B<dlopen>() adds the dynamically loaded shared "
425 "object to the same namespace as the shared object from which the "
426 "B<dlopen>() call is made.) The I<Lmid_t> type is an opaque handle that "
427 "refers to a namespace."
428 msgstr ""
429
430 #. FIXME: Is using dlinfo() RTLD_DI_LMID the right technique?
431 #. type: Plain text
432 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
433 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
434 msgid ""
435 "The I<lmid> argument is either the ID of an existing namespace (which can be "
436 "obtained using the B<dlinfo>(3) B<RTLD_DI_LMID> request) or one of the "
437 "following special values:"
438 msgstr ""
439
440 #. type: TP
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 #, no-wrap
444 msgid "B<LM_ID_BASE>"
445 msgstr ""
446
447 #. type: Plain text
448 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
449 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
450 msgid ""
451 "Load the shared object in the initial namespace (i.e., the application's "
452 "namespace)."
453 msgstr ""
454
455 #. type: TP
456 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
457 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
458 #, no-wrap
459 msgid "B<LM_ID_NEWLM>"
460 msgstr ""
461
462 #. type: Plain text
463 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
464 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
465 msgid ""
466 "Create a new namespace and load the shared object in that namespace. The "
467 "object must have been correctly linked to reference all of the other shared "
468 "objects that it requires, since the new namespace is initially empty."
469 msgstr ""
470
471 #. type: Plain text
472 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
473 #: opensuse-tumbleweed
474 msgid ""
475 "If I<path> is NULL, then the only permitted value for I<lmid> is "
476 "B<LM_ID_BASE>."
477 msgstr ""
478
479 #. type: SS
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 #, no-wrap
483 msgid "dlclose()"
484 msgstr ""
485
486 #. type: Plain text
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 msgid ""
490 "The function B<dlclose>() decrements the reference count on the dynamically "
491 "loaded shared object referred to by I<handle>."
492 msgstr ""
493
494 #. type: Plain text
495 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
496 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
497 msgid ""
498 "If the object's reference count drops to zero and no symbols in this object "
499 "are required by other objects, then the object is unloaded after first "
500 "calling any destructors defined for the object. (Symbols in this object "
501 "might be required in another object because this object was opened with the "
502 "B<RTLD_GLOBAL> flag and one of its symbols satisfied a relocation in another "
503 "object.)"
504 msgstr ""
505
506 #. type: Plain text
507 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
508 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
509 msgid ""
510 "All shared objects that were automatically loaded when B<dlopen>() was "
511 "invoked on the object referred to by I<handle> are recursively closed in the "
512 "same manner."
513 msgstr ""
514
515 #. type: Plain text
516 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
517 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
518 msgid ""
519 "A successful return from B<dlclose>() does not guarantee that the symbols "
520 "associated with I<handle> are removed from the caller's address space. In "
521 "addition to references resulting from explicit B<dlopen>() calls, a shared "
522 "object may have been implicitly loaded (and reference counted) because of "
523 "dependencies in other shared objects. Only when all references have been "
524 "released can the shared object be removed from the address space."
525 msgstr ""
526
527 #. type: SH
528 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
529 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
530 #, no-wrap
531 msgid "RETURN VALUE"
532 msgstr ""
533
534 #. type: Plain text
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 msgid ""
538 "On success, B<dlopen>() and B<dlmopen>() return a non-NULL handle for the "
539 "loaded object. On error (file could not be found, was not readable, had the "
540 "wrong format, or caused errors during loading), these functions return NULL."
541 msgstr ""
542
543 #. type: Plain text
544 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
545 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
546 msgid ""
547 "On success, B<dlclose>() returns 0; on error, it returns a nonzero value."
548 msgstr ""
549
550 #. type: Plain text
551 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
552 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
553 msgid "Errors from these functions can be diagnosed using B<dlerror>(3)."
554 msgstr ""
555
556 #. type: SH
557 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
558 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
559 #, no-wrap
560 msgid "ATTRIBUTES"
561 msgstr ""
562
563 #. type: Plain text
564 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
565 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
566 msgid ""
567 "For an explanation of the terms used in this section, see B<attributes>(7)."
568 msgstr ""
569
570 #. type: tbl table
571 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
572 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
573 #, no-wrap
574 msgid "Interface"
575 msgstr ""
576
577 #. type: tbl table
578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
580 #, no-wrap
581 msgid "Attribute"
582 msgstr ""
583
584 #. type: tbl table
585 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
586 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
587 #, no-wrap
588 msgid "Value"
589 msgstr ""
590
591 #. type: tbl table
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 #, no-wrap
595 msgid ".na\n"
596 msgstr ""
597
598 #. type: tbl table
599 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
600 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
601 #, no-wrap
602 msgid ".nh\n"
603 msgstr ""
604
605 #. type: tbl table
606 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
607 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
608 #, no-wrap
609 msgid ""
610 "B<dlopen>(),\n"
611 "B<dlmopen>(),\n"
612 "B<dlclose>()"
613 msgstr ""
614
615 #. type: tbl table
616 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
617 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
618 #, no-wrap
619 msgid "Thread safety"
620 msgstr ""
621
622 #. type: tbl table
623 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
624 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
625 #, no-wrap
626 msgid "MT-Safe"
627 msgstr ""
628
629 #. type: SH
630 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
631 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
632 #, no-wrap
633 msgid "STANDARDS"
634 msgstr ""
635
636 #. type: TP
637 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
638 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
639 #, no-wrap
640 msgid "B<dlopen>()"
641 msgstr ""
642
643 #. type: TQ
644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
646 #, no-wrap
647 msgid "B<dlclose>()"
648 msgstr ""
649
650 #. type: Plain text
651 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
652 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
653 msgid "POSIX.1-2008."
654 msgstr ""
655
656 #. type: TP
657 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
658 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
659 #, no-wrap
660 msgid "B<dlmopen>()"
661 msgstr ""
662
663 #. type: TQ
664 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
665 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
666 #, no-wrap
667 msgid "B<RTLD_NOLOAD>"
668 msgstr ""
669
670 #. type: TQ
671 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
672 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
673 #, no-wrap
674 msgid "B<RTLD_NODELETE>"
675 msgstr ""
676
677 #. type: Plain text
678 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
679 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
680 msgid "GNU."
681 msgstr ""
682
683 #. type: TP
684 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
685 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
686 #, no-wrap
687 msgid "B<RTLD_DEEPBIND>"
688 msgstr ""
689
690 #. type: Plain text
691 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
692 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
693 msgid "Solaris."
694 msgstr ""
695
696 #. type: SH
697 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
698 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
699 #, no-wrap
700 msgid "HISTORY"
701 msgstr ""
702
703 #. type: Plain text
704 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
705 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
706 msgid "glibc 2.0. POSIX.1-2001."
707 msgstr ""
708
709 #. type: Plain text
710 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
711 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
712 msgid "glibc 2.3.4."
713 msgstr ""
714
715 #. type: SH
716 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
717 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
718 #, no-wrap
719 msgid "NOTES"
720 msgstr ""
721
722 #. type: SS
723 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
724 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
725 #, no-wrap
726 msgid "dlmopen() and namespaces"
727 msgstr ""
728
729 #. type: Plain text
730 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
731 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
732 msgid ""
733 "A link-map list defines an isolated namespace for the resolution of symbols "
734 "by the dynamic linker. Within a namespace, dependent shared objects are "
735 "implicitly loaded according to the usual rules, and symbol references are "
736 "likewise resolved according to the usual rules, but such resolution is "
737 "confined to the definitions provided by the objects that have been "
738 "(explicitly and implicitly) loaded into the namespace."
739 msgstr ""
740
741 #. type: Plain text
742 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
743 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
744 msgid ""
745 "The B<dlmopen>() function permits object-load isolation\\[em]the ability to "
746 "load a shared object in a new namespace without exposing the rest of the "
747 "application to the symbols made available by the new object. Note that the "
748 "use of the B<RTLD_LOCAL> flag is not sufficient for this purpose, since it "
749 "prevents a shared object's symbols from being available to I<any> other "
750 "shared object. In some cases, we may want to make the symbols provided by a "
751 "dynamically loaded shared object available to (a subset of) other shared "
752 "objects without exposing those symbols to the entire application. This can "
753 "be achieved by using a separate namespace and the B<RTLD_GLOBAL> flag."
754 msgstr ""
755
756 #. type: Plain text
757 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
758 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
759 msgid ""
760 "The B<dlmopen>() function also can be used to provide better isolation than "
761 "the B<RTLD_LOCAL> flag. In particular, shared objects loaded with "
762 "B<RTLD_LOCAL> may be promoted to B<RTLD_GLOBAL> if they are dependencies of "
763 "another shared object loaded with B<RTLD_GLOBAL>. Thus, B<RTLD_LOCAL> is "
764 "insufficient to isolate a loaded shared object except in the (uncommon) "
765 "case where one has explicit control over all shared object dependencies."
766 msgstr ""
767
768 #. type: Plain text
769 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
770 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
771 msgid ""
772 "Possible uses of B<dlmopen>() are plugins where the author of the plugin-"
773 "loading framework can't trust the plugin authors and does not wish any "
774 "undefined symbols from the plugin framework to be resolved to plugin "
775 "symbols. Another use is to load the same object more than once. Without "
776 "the use of B<dlmopen>(), this would require the creation of distinct copies "
777 "of the shared object file. Using B<dlmopen>(), this can be achieved by "
778 "loading the same shared object file into different namespaces."
779 msgstr ""
780
781 #. DL_NNS
782 #. type: Plain text
783 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
784 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
785 msgid "The glibc implementation supports a maximum of 16 namespaces."
786 msgstr ""
787
788 #. type: SS
789 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
790 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
791 #, no-wrap
792 msgid "Initialization and finalization functions"
793 msgstr ""
794
795 #. info gcc "C Extensions" "Function attributes"
796 #. type: Plain text
797 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
798 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
799 msgid ""
800 "Shared objects may export functions using the "
801 "B<__attribute__((constructor))> and B<__attribute__((destructor))> function "
802 "attributes. Constructor functions are executed before B<dlopen>() returns, "
803 "and destructor functions are executed before B<dlclose>() returns. A "
804 "shared object may export multiple constructors and destructors, and "
805 "priorities can be associated with each function to determine the order in "
806 "which they are executed. See the B<gcc> info pages (under \"Function "
807 "attributes\") for further information."
808 msgstr ""
809
810 #. type: Plain text
811 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
812 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
813 msgid ""
814 "An older method of (partially) achieving the same result is via the use of "
815 "two special symbols recognized by the linker: B<_init> and B<_fini>. If a "
816 "dynamically loaded shared object exports a routine named B<_init>(), then "
817 "that code is executed after loading a shared object, before B<dlopen>() "
818 "returns. If the shared object exports a routine named B<_fini>(), then that "
819 "routine is called just before the object is unloaded. In this case, one "
820 "must avoid linking against the system startup files, which contain default "
821 "versions of these files; this can be done by using the B<gcc>(1) I<-"
822 "nostartfiles> command-line option."
823 msgstr ""
824
825 #
826 #. Using these routines, or the gcc
827 #. .B \-nostartfiles
828 #. or
829 #. .B \-nostdlib
830 #. options, is not recommended.
831 #. Their use may result in undesired behavior,
832 #. since the constructor/destructor routines will not be executed
833 #. (unless special measures are taken).
834 #. .\" void _init(void) __attribute__((constructor));
835 #. .\" void _fini(void) __attribute__((destructor));
836 #. type: Plain text
837 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
838 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
839 msgid ""
840 "Use of B<_init> and B<_fini> is now deprecated in favor of the "
841 "aforementioned constructors and destructors, which among other advantages, "
842 "permit multiple initialization and finalization functions to be defined."
843 msgstr ""
844
845 #. type: Plain text
846 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
847 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
848 msgid ""
849 "Since glibc 2.2.3, B<atexit>(3) can be used to register an exit handler "
850 "that is automatically called when a shared object is unloaded."
851 msgstr ""
852
853 #. type: SS
854 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
855 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
856 #, no-wrap
857 msgid "History"
858 msgstr ""
859
860 #. type: Plain text
861 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
862 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
863 msgid "These functions are part of the dlopen API, derived from SunOS."
864 msgstr ""
865
866 #. type: SH
867 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
868 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
869 #, no-wrap
870 msgid "BUGS"
871 msgstr ""
872
873 #. dlerror(): "invalid mode"
874 #. https://sourceware.org/bugzilla/show_bug.cgi?id=18684
875 #. type: Plain text
876 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
877 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
878 msgid ""
879 "As at glibc 2.24, specifying the B<RTLD_GLOBAL> flag when calling "
880 "B<dlmopen>() generates an error. Furthermore, specifying B<RTLD_GLOBAL> "
881 "when calling B<dlopen>() results in a program crash (B<SIGSEGV>) if the "
882 "call is made from any object loaded in a namespace other than the initial "
883 "namespace."
884 msgstr ""
885
886 #. type: SH
887 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
888 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
889 #, no-wrap
890 msgid "EXAMPLES"
891 msgstr ""
892
893 #. type: Plain text
894 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
895 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
896 msgid ""
897 "The program below loads the (glibc) math library, looks up the address of "
898 "the B<cos>(3) function, and prints the cosine of 2.0. The following is an "
899 "example of building and running the program:"
900 msgstr ""
901
902 #. type: Plain text
903 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
904 #: opensuse-tumbleweed
905 #, no-wrap
906 msgid ""
907 "$B< cc dlopen_demo.c -ldl>;\n"
908 "$B< ./a.out>;\n"
909 "-0.416147\n"
910 msgstr ""
911
912 #. type: SS
913 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
914 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
915 #, no-wrap
916 msgid "Program source"
917 msgstr ""
918
919 #. http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
920 #. http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
921 #. http://austingroupbugs.net/view.php?id=74
922 #. type: Plain text
923 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
924 #: opensuse-tumbleweed
925 #, no-wrap
926 msgid ""
927 "#include E<lt>dlfcn.hE<gt>\n"
928 "#include E<lt>stdio.hE<gt>\n"
929 "#include E<lt>stdlib.hE<gt>\n"
930 "\\&\n"
931 "#include E<lt>gnu/lib-names.hE<gt> /* Defines LIBM_SO (which will be a\n"
932 " string such as \"libm.so.6\") */\n"
933 "int\n"
934 "main(void)\n"
935 "{\n"
936 " void *handle;\n"
937 " typeof(double (double)) *cosine;\n"
938 " char *error;\n"
939 "\\&\n"
940 " handle = dlopen(LIBM_SO, RTLD_LAZY);\n"
941 " if (!handle) {\n"
942 " fprintf(stderr, \"%s\\[rs]n\", dlerror());\n"
943 " exit(EXIT_FAILURE);\n"
944 " }\n"
945 "\\&\n"
946 " dlerror(); /* Clear any existing error */\n"
947 "\\&\n"
948 " cosine = (typeof(double (double)) *) dlsym(handle, \"cos\");\n"
949 "\\&\n"
950 " /* According to the ISO C standard, casting between function\n"
951 " pointers and \\[aq]void *\\[aq], as done above, produces undefined results.\n"
952 " POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and\n"
953 " proposed the following workaround:\n"
954 "\\&\n"
955 " *(void **) &cosine = dlsym(handle, \"cos\");\n"
956 "\\&\n"
957 " This (clumsy) cast conforms with the ISO C standard and will\n"
958 " avoid any compiler warnings.\n"
959 "\\&\n"
960 " The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters\n"
961 " by requiring that conforming implementations support casting\n"
962 " \\[aq]void *\\[aq] to a function pointer. Nevertheless, some compilers\n"
963 " (e.g., gcc with the \\[aq]-pedantic\\[aq] option) may complain about the\n"
964 " cast used in this program. */\n"
965 "\\&\n"
966 " error = dlerror();\n"
967 " if (error != NULL) {\n"
968 " fprintf(stderr, \"%s\\[rs]n\", error);\n"
969 " exit(EXIT_FAILURE);\n"
970 " }\n"
971 "\\&\n"
972 " printf(\"%f\\[rs]n\", (*cosine)(2.0));\n"
973 " dlclose(handle);\n"
974 " exit(EXIT_SUCCESS);\n"
975 "}\n"
976 msgstr ""
977
978 #. SRC END
979 #. type: SH
980 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
981 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
982 #, no-wrap
983 msgid "SEE ALSO"
984 msgstr ""
985
986 #. type: Plain text
987 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
988 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
989 msgid ""
990 "B<ld>(1), B<ldd>(1), B<pldd>(1), B<dl_iterate_phdr>(3), B<dladdr>(3), "
991 "B<dlerror>(3), B<dlinfo>(3), B<dlsym>(3), B<rtld-audit>(7), B<ld.so>(8), "
992 "B<ldconfig>(8)"
993 msgstr ""
994
995 #. type: Plain text
996 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
997 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
998 msgid "gcc info pages, ld info pages"
999 msgstr ""
1000
1001 #. type: TH
1002 #: debian-trixie
1003 #, no-wrap
1004 msgid "2024-06-15"
1005 msgstr ""
1006
1007 #. type: TH
1008 #: debian-trixie
1009 #, no-wrap
1010 msgid "Linux man-pages 6.9.1"
1011 msgstr ""
1012
1013 #. type: Plain text
1014 #: debian-trixie
1015 msgid "Dynamic linking library (I<libdl>, I<-ldl>)"
1016 msgstr ""
1017
1018 #. type: Plain text
1019 #: debian-trixie fedora-44 fedora-rawhide
1020 #, no-wrap
1021 msgid ""
1022 "B<void *dlopen(const char *>I<filename>B<, int >I<flags>B<);>\n"
1023 "B<int dlclose(void *>I<handle>B<);>\n"
1024 msgstr ""
1025
1026 #. type: Plain text
1027 #: debian-trixie fedora-44 fedora-rawhide
1028 #, no-wrap
1029 msgid "B<void *dlmopen(Lmid_t >I<lmid>B<, const char *>I<filename>B<, int >I<flags>B<);>\n"
1030 msgstr ""
1031
1032 #. type: Plain text
1033 #: debian-trixie fedora-44 fedora-rawhide
1034 msgid ""
1035 "The function B<dlopen>() loads the dynamic shared object (shared library) "
1036 "file named by the null-terminated string I<filename> and returns an opaque "
1037 "\"handle\" for the loaded object. This handle is employed with other "
1038 "functions in the dlopen API, such as B<dlsym>(3), B<dladdr>(3), "
1039 "B<dlinfo>(3), and B<dlclose>()."
1040 msgstr ""
1041
1042 #. FIXME On Solaris, when handle is NULL, we seem to get back
1043 #. a handle for (something like) the root of the namespace.
1044 #. The point here is that if we do a dlmopen(LM_ID_NEWLM), then
1045 #. the filename==NULL case returns a different handle than
1046 #. in the initial namespace. But, on glibc, the same handle is
1047 #. returned. This is probably a bug in glibc.
1048 #. type: Plain text
1049 #: debian-trixie fedora-44 fedora-rawhide
1050 msgid ""
1051 "If I<filename> is NULL, then the returned handle is for the main program. "
1052 "If I<filename> contains a slash (\"/\"), then it is interpreted as a "
1053 "(relative or absolute) pathname. Otherwise, the dynamic linker searches for "
1054 "the object as follows (see B<ld.so>(8) for further details):"
1055 msgstr ""
1056
1057 #. type: Plain text
1058 #: debian-trixie fedora-44 fedora-rawhide
1059 msgid ""
1060 "The cache file I</etc/ld.so.cache> (maintained by B<ldconfig>(8)) is "
1061 "checked to see whether it contains an entry for I<filename>."
1062 msgstr ""
1063
1064 #. type: Plain text
1065 #: debian-trixie fedora-44 fedora-rawhide
1066 msgid ""
1067 "If the object specified by I<filename> has dependencies on other shared "
1068 "objects, then these are also automatically loaded by the dynamic linker "
1069 "using the same rules. (This process may occur recursively, if those objects "
1070 "in turn have dependencies, and so on.)"
1071 msgstr ""
1072
1073 #. type: Plain text
1074 #: debian-trixie fedora-44 fedora-rawhide
1075 msgid ""
1076 "If I<filename> is NULL, then the returned handle is for the main program. "
1077 "When given to B<dlsym>(3), this handle causes a search for a symbol in the "
1078 "main program, followed by all shared objects loaded at program startup, and "
1079 "then all shared objects loaded by B<dlopen>() with the flag B<RTLD_GLOBAL>."
1080 msgstr ""
1081
1082 #. type: Plain text
1083 #: debian-trixie fedora-44 fedora-rawhide
1084 msgid ""
1085 "This function performs the same task as B<dlopen>()\\[em]the I<filename> and "
1086 "I<flags> arguments, as well as the return value, are the same, except for "
1087 "the differences noted below."
1088 msgstr ""
1089
1090 #. type: Plain text
1091 #: debian-trixie fedora-44 fedora-rawhide
1092 msgid ""
1093 "If I<filename> is NULL, then the only permitted value for I<lmid> is "
1094 "B<LM_ID_BASE>."
1095 msgstr ""
1096
1097 #. type: Plain text
1098 #: debian-trixie fedora-44 fedora-rawhide
1099 #, no-wrap
1100 msgid ""
1101 "$ B<cc dlopen_demo.c -ldl>\n"
1102 "$ B<./a.out>\n"
1103 "-0.416147\n"
1104 msgstr ""
1105
1106 #. http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
1107 #. http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
1108 #. http://austingroupbugs.net/view.php?id=74
1109 #. type: Plain text
1110 #: debian-trixie
1111 #, no-wrap
1112 msgid ""
1113 "#include E<lt>dlfcn.hE<gt>\n"
1114 "#include E<lt>stdio.hE<gt>\n"
1115 "#include E<lt>stdlib.hE<gt>\n"
1116 "\\&\n"
1117 "#include E<lt>gnu/lib-names.hE<gt> /* Defines LIBM_SO (which will be a\n"
1118 " string such as \"libm.so.6\") */\n"
1119 "int\n"
1120 "main(void)\n"
1121 "{\n"
1122 " void *handle;\n"
1123 " double (*cosine)(double);\n"
1124 " char *error;\n"
1125 "\\&\n"
1126 " handle = dlopen(LIBM_SO, RTLD_LAZY);\n"
1127 " if (!handle) {\n"
1128 " fprintf(stderr, \"%s\\[rs]n\", dlerror());\n"
1129 " exit(EXIT_FAILURE);\n"
1130 " }\n"
1131 "\\&\n"
1132 " dlerror(); /* Clear any existing error */\n"
1133 "\\&\n"
1134 " cosine = (double (*)(double)) dlsym(handle, \"cos\");\n"
1135 "\\&\n"
1136 " /* According to the ISO C standard, casting between function\n"
1137 " pointers and \\[aq]void *\\[aq], as done above, produces undefined results.\n"
1138 " POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and\n"
1139 " proposed the following workaround:\n"
1140 "\\&\n"
1141 " *(void **) (&cosine) = dlsym(handle, \"cos\");\n"
1142 "\\&\n"
1143 " This (clumsy) cast conforms with the ISO C standard and will\n"
1144 " avoid any compiler warnings.\n"
1145 "\\&\n"
1146 " The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters\n"
1147 " by requiring that conforming implementations support casting\n"
1148 " \\[aq]void *\\[aq] to a function pointer. Nevertheless, some compilers\n"
1149 " (e.g., gcc with the \\[aq]-pedantic\\[aq] option) may complain about the\n"
1150 " cast used in this program. */\n"
1151 "\\&\n"
1152 " error = dlerror();\n"
1153 " if (error != NULL) {\n"
1154 " fprintf(stderr, \"%s\\[rs]n\", error);\n"
1155 " exit(EXIT_FAILURE);\n"
1156 " }\n"
1157 "\\&\n"
1158 " printf(\"%f\\[rs]n\", (*cosine)(2.0));\n"
1159 " dlclose(handle);\n"
1160 " exit(EXIT_SUCCESS);\n"
1161 "}\n"
1162 msgstr ""
1163
1164 #. type: TH
1165 #: fedora-44 fedora-rawhide
1166 #, no-wrap
1167 msgid "2025-01-05"
1168 msgstr ""
1169
1170 #. type: TH
1171 #: fedora-44 fedora-rawhide
1172 #, no-wrap
1173 msgid "Linux man-pages 6.13"
1174 msgstr ""
1175
1176 #. http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
1177 #. http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
1178 #. http://austingroupbugs.net/view.php?id=74
1179 #. type: Plain text
1180 #: fedora-44 fedora-rawhide
1181 #, no-wrap
1182 msgid ""
1183 "#include E<lt>dlfcn.hE<gt>\n"
1184 "#include E<lt>stdio.hE<gt>\n"
1185 "#include E<lt>stdlib.hE<gt>\n"
1186 "\\&\n"
1187 "#include E<lt>gnu/lib-names.hE<gt> /* Defines LIBM_SO (which will be a\n"
1188 " string such as \"libm.so.6\") */\n"
1189 "int\n"
1190 "main(void)\n"
1191 "{\n"
1192 " void *handle;\n"
1193 " typeof(double (double)) *cosine;\n"
1194 " char *error;\n"
1195 "\\&\n"
1196 " handle = dlopen(LIBM_SO, RTLD_LAZY);\n"
1197 " if (!handle) {\n"
1198 " fprintf(stderr, \"%s\\[rs]n\", dlerror());\n"
1199 " exit(EXIT_FAILURE);\n"
1200 " }\n"
1201 "\\&\n"
1202 " dlerror(); /* Clear any existing error */\n"
1203 "\\&\n"
1204 " cosine = (typeof(double (double)) *) dlsym(handle, \"cos\");\n"
1205 "\\&\n"
1206 " /* According to the ISO C standard, casting between function\n"
1207 " pointers and \\[aq]void *\\[aq], as done above, produces undefined results.\n"
1208 " POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and\n"
1209 " proposed the following workaround:\n"
1210 "\\&\n"
1211 " *(void **) &cosine = dlsym(handle, \"cos\");\n"
1212 "\\&\n"
1213 " This (clumsy) cast conforms with the ISO C standard and will\n"
1214 " avoid any compiler warnings.\n"
1215 "\\&\n"
1216 " The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters\n"
1217 " by requiring that conforming implementations support casting\n"
1218 " \\[aq]void *\\[aq] to a function pointer. Nevertheless, some compilers\n"
1219 " (e.g., gcc with the \\[aq]-pedantic\\[aq] option) may complain about the\n"
1220 " cast used in this program. */\n"
1221 "\\&\n"
1222 " error = dlerror();\n"
1223 " if (error != NULL) {\n"
1224 " fprintf(stderr, \"%s\\[rs]n\", error);\n"
1225 " exit(EXIT_FAILURE);\n"
1226 " }\n"
1227 "\\&\n"
1228 " printf(\"%f\\[rs]n\", (*cosine)(2.0));\n"
1229 " dlclose(handle);\n"
1230 " exit(EXIT_SUCCESS);\n"
1231 "}\n"
1232 msgstr ""
1233
1234 #. type: TH
1235 #: mageia-cauldron
1236 #, no-wrap
1237 msgid "Linux man-pages 6.17"
1238 msgstr ""
1239
1240 #. type: TH
1241 #: opensuse-leap-16-1 opensuse-tumbleweed
1242 #, no-wrap
1243 msgid "Linux man-pages (unreleased)"
1244 msgstr ""