2003-04-22 Roland McGrath <roland@redhat.com>
[glibc.git] / include / dlfcn.h
blobf0af0fc0f1f3b41300249b4651e40fe4ed78fb2a
1 #ifndef _DLFCN_H
2 #include <dlfcn/dlfcn.h>
3 #include <link.h> /* For ElfW. */
5 /* Internally used flag. */
6 #define __RTLD_DLOPEN 0x80000000
7 #define __RTLD_SPROF 0x40000000
9 /* Now define the internal interfaces. */
10 extern void *__dlvsym (void *__handle, __const char *__name,
11 __const char *__version);
13 #define __libc_dlopen(name) __libc_dlopen_mode (name, RTLD_LAZY)
14 extern void *__libc_dlopen_mode (__const char *__name, int __mode);
15 extern void *__libc_dlsym (void *__map, __const char *__name);
16 extern int __libc_dlclose (void *__map);
18 /* Locate shared object containing the given address. */
19 #ifdef ElfW
20 extern int _dl_addr (const void *address, Dl_info *info,
21 struct link_map **mapp, const ElfW(Sym) **symbolp)
22 internal_function;
23 libc_hidden_proto (_dl_addr)
24 #endif
26 /* Open the shared object NAME, relocate it, and run its initializer if it
27 hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If
28 the object is already opened, returns its existing map. */
29 extern void *_dl_open (const char *name, int mode, const void *caller)
30 internal_function;
31 libc_hidden_proto (_dl_open)
33 /* Close an object previously opened by _dl_open. */
34 extern void _dl_close (void *map)
35 internal_function;
36 libc_hidden_proto (_dl_close)
38 /* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or
39 RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns
40 the symbol value, which may be NULL. */
41 extern void *_dl_sym (void *handle, const char *name, void *who)
42 internal_function;
44 /* Look up version VERSION of symbol NAME in shared object HANDLE
45 (which may be RTLD_DEFAULT or RTLD_NEXT). WHO is the calling
46 function, for RTLD_NEXT. Returns the symbol value, which may be
47 NULL. */
48 extern void *_dl_vsym (void *handle, const char *name, const char *version,
49 void *who)
50 internal_function;
52 /* Call OPERATE, catching errors from `dl_signal_error'. If there is no
53 error, *ERRSTRING is set to null. If there is an error, *ERRSTRING is
54 set to a string constructed from the strings passed to _dl_signal_error,
55 and the error code passed is the return value and *OBJNAME is set to
56 the object name which experienced the problems. ERRSTRING if nonzero
57 points to a malloc'ed string which the caller has to free after use.
58 ARGS is passed as argument to OPERATE. */
59 extern int _dl_catch_error (const char **objname, const char **errstring,
60 void (*operate) (void *),
61 void *args)
62 internal_function;
63 extern int _dl_catch_error_internal (const char **objname,
64 const char **errstring,
65 void (*operate) (void *), void *args)
66 internal_function;
68 /* Helper function for <dlfcn.h> functions. Runs the OPERATE function via
69 _dl_catch_error. Returns zero for success, nonzero for failure; and
70 arranges for `dlerror' to return the error details.
71 ARGS is passed as argument to OPERATE. */
72 extern int _dlerror_run (void (*operate) (void *), void *args)
73 internal_function;
75 #endif