📄 dladdr.3
字号:
.\".\" Copyright (c) 1998 John D. Polstra.\" All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\".\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/dladdr.3,v 1.3.2.4 2003/03/15 15:11:05 trhodes Exp $.\".Dd June 8, 2003.Os.Dt DLADDR 3.Sh NAME.Nm dladdr.Nd find the shared object containing a given address.Sh SYNOPSIS.In dlfcn.h.Ft int.Fn dladdr "const void *addr" "Dl_info *info".Sh DESCRIPTIONThe.Fn dladdrfunctionqueries the dynamic linker for information about the shared objectcontaining the address.Fa addr .The information is returned in the structure specified by.Fa info .The structure contains at least the following members:.Bl -tag -width "XXXconst char *dli_fname".It Li "const char *dli_fname"The pathname of the shared object containing the address..It Li "void *dli_fbase"The base address at which the shared object is mapped into theaddress space of the calling process..It Li "const char *dli_sname"The name of the nearest run-time symbol with a value less than orequal to.Fa addr ..PpIf no symbol with a suitable value is found, both this field and.Va dli_saddrare set to.Dv NULL ..It Li "void *dli_saddr"The value of the symbol returned in.Li dli_sname ..El.PpThe.Fn dladdrfunctionis available only in dynamically linked programs..Sh ERRORSIf a mapped shared object containing.Fa addrcannot be found,.Fn dladdrreturns 0..PpOn success, a non-zero value is returned..Sh SEE ALSO.Xr dyld 3 ,.Xr dlopen 3.Sh HISTORYThe.Fn dladdrfunction first appeared in the Solaris operating system..Sh AUTHORSThe dlcompat package was written by Jorge Acereda <jacereda@users.sourceforge.net> andPeter O'Gorman <ogorman@users.sourceforge.net>.PpSome of the code for this particular function was borrowed froma post to the darwin development list by Douglas Davidson..PpThis man page was borrowed from FreeBSD and modified..Sh BUGSThis implementation is almost bug-compatible with the Solarisimplementation. The following bugs are present:.Bl -bullet.ItIf.Fa addrlies in the main executable rather than in a shared library, thepathname returned in.Va dli_fnamemay not be correct. The pathname is taken directly from.Va argv[0]of the calling process. When executing a program specified by itsfull pathname, most shells set.Va argv[0]to the pathname. But this is not required of shells or guaranteedby the operating system..It.Fn dlerrorcan not be used to get the error string if .Fn dladdrfails..ItThe symbol returned has an underscore if it is a C symbol, and cannot be used as input to .Fn dlsymas.Fn dlsym in a default dlcompat installation takes symbol names as they appearin C source code (no underscore)..ItReturning 0 as an indication of failure goes against long-standingUnix tradition..El
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -