]> git.saurik.com Git - apple/dyld.git/blame_incremental - doc/man/man3/dladdr.3
dyld-239.3.tar.gz
[apple/dyld.git] / doc / man / man3 / dladdr.3
... / ...
CommitLineData
1.Dd September 24, 2004
2.Os
3.Dt DLADDR 3
4.Sh NAME
5.Nm dladdr
6.Nd find the image containing a given address
7.Sh SYNOPSIS
8.In dlfcn.h
9.Ft int
10.Fn dladdr "const void* addr" "Dl_info* info"
11.Sh DESCRIPTION
12The
13.Fn dladdr
14function
15queries dyld (the dynamic linker) for information about the image
16containing the address
17.Fa addr .
18The information is returned in the structure specified by
19.Fa info .
20The structure contains at least the following members:
21.Bl -tag -width "XXXconst char *dli_fname"
22.It Li "const char* dli_fname"
23The pathname of the shared object containing the address.
24.It Li "void* dli_fbase"
25The base address (mach_header) at which the image is mapped into the
26address space of the calling process.
27.It Li "const char* dli_sname"
28The name of the nearest run-time symbol with a value less than or
29equal to
30.Fa addr .
31.It Li "void* dli_saddr"
32The value of the symbol returned in
33.Li dli_sname .
34.El
35.Pp
36The
37.Fn dladdr
38function
39is available only in dynamically linked programs.
40.Sh ERRORS
41If an image containing
42.Fa addr
43cannot be found,
44.Fn dladdr
45returns 0.
46On success, a non-zero value is returned.
47.Pp
48If the image containing
49.Fa addr
50is found, but no nearest symbol was found,
51the dli_sname and dli_saddr fields are set to NULL.
52.Sh SEE ALSO
53.Xr dyld 3 ,
54.Xr dlopen 3
55.Sh HISTORY
56The
57.Fn dladdr
58function first appeared in the Solaris operating system.
59.Sh AUTHORS
60Mac OS X 10.3 incorporated the dlcompat package written by Jorge Acereda <jacereda@users.sourceforge.net>
61and Peter O'Gorman <ogorman@users.sourceforge.net>.
62.Pp
63In Mac OS X 10.4, dlopen was rewritten to be a native part of dyld.
64.Pp
65This man page was borrowed from FreeBSD and modified.
66.Sh BUGS
67This implementation is almost bug-compatible with the Solaris
68implementation. The following bugs are present:
69.Bl -bullet
70.It
71Returning 0 as an indication of failure goes against long-standing
72Unix tradition.
73.El