Penguin
Annotated edit history of dladdr(3) version 3, including all changes. View license author blame.
Rev Author # Line
1 SamJansen 1 !!NAME
2
3 __dladdr__ -- find the shared object containing a given address
4
5 !!LIBRARY
6
7 Standard C Library (libc, -lc)
8
9 !!SYNOPSIS
10
3 CraigBox 11 __#include <dlfcn.h>__ %%%
1 SamJansen 12 __''int''__ __dladdr__(__''const void *addr''__, __''Dl''_''info *info''__);
13
14
15 !!DESCRIPTION
16
17 The __dladdr__() function queries the dynamic linker for information about the shared object containing the address __''addr''__. The information is returned in the structure specified by __''info''__. The structure contains at least the following members:
18
19 const char *dli_fname
20 The pathname of the shared object containing the address.
21
22 void *dli_fbase
23 The base address at which the shared object is mapped into the address space of the calling process.
24
25 const char *dli_sname
26 The name of the nearest run-time symbol with a value less than or equal to __''addr''__. When possible, the symbol name is returned as it would appear in C source code. If no symbol with a suitable value is found, both this field and __''dli''_''saddr''__ are set to NULL.
27
28 void *dli_saddr
29 The value of the symbol returned in dli_sname.
30
31 The __dladdr__() function is available only in dynamically linked programs.
32
33 !!ERRORS
34
3 CraigBox 35 If a mapped shared object containing __''addr''__ cannot be found, __dladdr__() returns 0. In that case, a message detailing the failure can be retrieved by calling __dlerror__().
1 SamJansen 36
37 On success, a non-zero value is returned.
38
39
40 !!SEE ALSO
41
42
43 rtld(1), dlopen(3)
44
45
46 !!HISTORY
47
48
49 The __dladdr__() function first appeared in the Solaris operating system.
50
51
52 !!BUGS
53
54
55 This implementation is bug-compatible with the Solaris implementation.
56
57 In particular, the following bugs are present:
58
3 CraigBox 59 * If __''addr''__ lies in the main executable rather than in a shared library, the pathname returned in __''dli''_''fname''__ may not be correct. The pathname is taken directly from __''argv[[0]''__ of the calling process. When executing a program specified by its full pathname, most shells set __''argv[[0]''__ to the pathname. But this is not required of shells or guaranteed by the operating system.
1 SamJansen 60
61
3 CraigBox 62 * If __''addr''__ is of the form __''&func''__, where __''func''__ is a global function, its value may be an unpleasant surprise. In dynamically linked programs, the address of a global function is considered to point to its program linkage table entry, rather than to the entry point of the function itself. This causes most global functions to appear to be defined within the main executable, rather than in the shared libraries where the actual code resides.
1 SamJansen 63
64 * Returning 0 as an indication of failure goes against long-standing Unix tradition.
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 10 times)