1 /* 2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _DLFCN_H 6 #define _DLFCN_H 7 8 9 #include <sys/types.h> 10 11 12 #define RTLD_LAZY 0 /* relocations are performed as needed */ 13 #define RTLD_NOW 1 /* the file gets relocated at load time */ 14 #define RTLD_LOCAL 0 /* symbols are not available for relocating any other object */ 15 #define RTLD_GLOBAL 2 /* all symbols are available */ 16 17 /* not-yet-POSIX extensions (dlsym() handles) */ 18 #define RTLD_DEFAULT ((void*)0) 19 /* find the symbol in the global scope */ 20 #define RTLD_NEXT ((void*)-1L) 21 /* find the next definition of the symbol */ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* This is a gnu extension for the dladdr function */ 28 typedef struct { 29 const char *dli_fname; /* Filename of defining object */ 30 void *dli_fbase; /* Load address of that object */ 31 const char *dli_sname; /* Name of nearest lower symbol */ 32 void *dli_saddr; /* Exact value of nearest symbol */ 33 } Dl_info_t; 34 typedef Dl_info_t Dl_info; 35 36 extern int dlclose(void *image); 37 extern char *dlerror(void); 38 extern void *dlopen(const char *path, int mode); 39 extern void *dlsym(void *image, const char *symbolName); 40 extern int dladdr(const void *addr, Dl_info_t *info); 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* _DLFCN_H */ 47