| 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 |
#ifdef __wasilibc_unmodified_upstream |
| 16 |
#define RTLD_LOCAL 0 |
| 17 |
#else |
| 18 |
/* For WASI, we give `RTLD_LOCAL` a non-zero value, avoiding ambiguity and |
| 19 |
* allowing us to defer the decision of whether `RTLD_LOCAL` or `RTLD_GLOBAL` |
| 20 |
* should be the default when neither is specified. |
| 21 |
*/ |
| 22 |
#define RTLD_LOCAL 8 |
| 23 |
#endif |
| 24 |
|
| 25 |
#define RTLD_NEXT ((void *)-1) |
| 26 |
#define RTLD_DEFAULT ((void *)0) |
| 27 |
|
| 28 |
#ifdef __wasilibc_unmodified_upstream |
| 29 |
#define RTLD_DI_LINKMAP 2 |
| 30 |
#endif |
| 31 |
|
| 32 |
int dlclose(void *); |
| 33 |
char *dlerror(void); |
| 34 |
void *dlopen(const char *, int); |
| 35 |
void *dlsym(void *__restrict, const char *__restrict); |
| 36 |
|
| 37 |
#if defined(__wasilibc_unmodified_upstream) && (defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) |
| 38 |
typedef struct { |
| 39 |
const char *dli_fname; |
| 40 |
void *dli_fbase; |
| 41 |
const char *dli_sname; |
| 42 |
void *dli_saddr; |
| 43 |
} Dl_info; |
| 44 |
int dladdr(const void *, Dl_info *); |
| 45 |
int dlinfo(void *, int, void *); |
| 46 |
#endif |
| 47 |
|
| 48 |
#if _REDIR_TIME64 |
| 49 |
__REDIR(dlsym, __dlsym_time64); |
| 50 |
#endif |
| 51 |
|
| 52 |
#ifdef __cplusplus |
| 53 |
} |
| 54 |
#endif |
| 55 |
|
| 56 |
#endif |