• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef	_DLFCN_H
2 #define	_DLFCN_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <features.h>
9 
10 #define RTLD_LAZY   1
11 #define RTLD_NOW    2
12 #define RTLD_NOLOAD 4
13 #define RTLD_NODELETE 4096
14 #define RTLD_GLOBAL 256
15 #define RTLD_LOCAL  0
16 
17 #define RTLD_NEXT    ((void *)-1)
18 #define RTLD_DEFAULT ((void *)0)
19 
20 #define RTLD_DI_LINKMAP 2
21 
22 int    dlclose(void *);
23 char  *dlerror(void);
24 void  *dlopen(const char *, int);
25 void  *dlsym(void *__restrict, const char *__restrict);
26 
27 /* namespace apis */
28 typedef const char* Dl_namespace;
29 
30 void dlns_init(Dl_namespace *, const char *);
31 
32 /* open dso in given namespace which has own lib search paths
33  * when namespace is null, it's same to dlopen()
34  * void to use "default" as namespace, which is the default namespace*/
35 void *dlopen_ns(Dl_namespace *, const char *, int);
36 
37 /* create the namespace and set lib search paths of namespace,
38  * the paths should be splited by ':'. When namespace already exist,
39  * return error */
40 int dlns_create(Dl_namespace *, const char *);
41 
42 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
43 typedef struct {
44 	const char *dli_fname;
45 	void *dli_fbase;
46 	const char *dli_sname;
47 	void *dli_saddr;
48 } Dl_info;
49 int dladdr(const void *, Dl_info *);
50 int dlinfo(void *, int, void *);
51 #endif
52 
53 #if _REDIR_TIME64
54 __REDIR(dlsym, __dlsym_time64);
55 #endif
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif
62