update from main archive 961005
[glibc/history.git] / elf / dlfcn.h
blobb26a38fb68a4c92cf16170a85b5f9fc6d84ad1ef
1 /* dlfcn.h -- User functions for run-time dynamic loading.
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
20 #ifndef _DLFCN_H
21 #define _DLFCN_H 1
24 /* The MODE argument to `dlopen' contains one of the following: */
25 #define RTLD_LAZY 0x001 /* Lazy function call binding. */
26 #define RTLD_NOW 0x002 /* Immediate function call binding. */
27 #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
29 /* If the following bit is set in the MODE argument to `dlopen',
30 the symbols of the loaded object and its dependencies are made
31 visible as if the object were linked directly into the program. */
32 #define RTLD_GLOBAL 0x100
34 /* Open the shared object FILE and map it in; return a handle that can be
35 passed to `dlsym' to get symbol values from it. */
36 extern void *dlopen (const char *__file, int __mode);
38 /* Unmap and close a shared object opened by `dlopen'.
39 The handle cannot be used again after calling `dlclose'. */
40 extern int dlclose (void *__handle);
42 /* Find the run-time address in the shared object HANDLE refers to
43 of the symbol called NAME. */
44 extern void *dlsym (void *__handle, const char *__name);
46 /* When any of the above functions fails, call this function
47 to return a string describing the error. Each call resets
48 the error string so that a following call returns null. */
49 extern char *dlerror (void);
51 /* Fill in *INFO with the following information about ADDRESS.
52 Returns 0 iff no shared object's segments contain that address. */
53 typedef struct
55 const char *dli_fname; /* File name of defining object. */
56 void *dli_fbase; /* Load address of that object. */
57 const char *dli_sname; /* Name of nearest symbol. */
58 void *dli_saddr; /* Exact value of nearest symbol. */
59 } Dl_info;
60 extern int dladdr (void *__address, Dl_info *__info);
62 #endif /* dlfcn.h */