1 #ifndef	_DLFCN_H
2 #define	_DLFCN_H
3 
4 #include <features.h>
5 #include <stdbool.h>
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #define RTLD_LAZY   1
12 #define RTLD_NOW    2
13 #define RTLD_NOLOAD 4
14 #define RTLD_NODELETE 4096
15 #define RTLD_GLOBAL 256
16 #define RTLD_LOCAL  0
17 
18 #define RTLD_NEXT    ((void *)-1)
19 #define RTLD_DEFAULT ((void *)0)
20 
21 #define RTLD_DI_LINKMAP 2
22 
23 int    dlclose(void *);
24 char  *dlerror(void);
25 void  *dlopen(const char *, int);
26 void  *dlsym(void *__restrict, const char *__restrict);
27 
28 
29 /**
30  * @brief Obtain address of a symbol in a shared object or executable
31  *
32  * @param (void *__restrict) the handle to the dynamic link library
33  * @param (const char *restrict) the name of the symbol to be looked up
34  * @param (const char *restrict) the specific version of the symbol to be looked up
35  *
36  * @return On success, return the address associated with symbol. On failure, return NULL
37  * @since 12
38 */
39 void *dlvsym(void *__restrict, const char *__restrict, const char *__restrict);
40 
41 /* namespace apis */
42 #define NS_NAME_MAX 255
43 typedef struct {
44 	char name[NS_NAME_MAX+1];
45 } Dl_namespace;
46 
47 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
48 typedef struct {
49 	const char *dli_fname;
50 	void *dli_fbase;
51 	const char *dli_sname;
52 	void *dli_saddr;
53 } Dl_info;
54 int dladdr(const void *, Dl_info *);
55 #endif
56 
57 #if _REDIR_TIME64
58 __REDIR(dlsym, __dlsym_time64);
59 #endif
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif
66