Back to index

glibc  2.9
dladdr.c
Go to the documentation of this file.
00001 /* Locate the shared object symbol nearest a given address.
00002    Copyright (C) 1996, 1997, 1998, 1999, 2003, 2004
00003    Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #include <dlfcn.h>
00022 
00023 #if !defined SHARED && defined IS_IN_libdl
00024 
00025 int
00026 dladdr (const void *address, Dl_info *info)
00027 {
00028   return __dladdr (address, info);
00029 }
00030 
00031 #else
00032 
00033 int
00034 __dladdr (const void *address, Dl_info *info)
00035 {
00036 # ifdef SHARED
00037   if (__builtin_expect (_dlfcn_hook != NULL, 0))
00038     return _dlfcn_hook->dladdr (address, info);
00039 # endif
00040   return _dl_addr (address, info, NULL, NULL);
00041 }
00042 # ifdef SHARED
00043 strong_alias (__dladdr, dladdr)
00044 # endif
00045 #endif