• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Stub dlfcn implementation for systems that lack shared library support
3  * but obviously can still reference compiled-in symbols.
4  */
5 
6 #ifndef NO_SHARED_LIBS
7 #include_next <dlfcn.h>
8 #else
9 
10 #define RTLD_LAZY 0
11 #define RTLD_GLOBAL 1
12 #define _FAKE_DLFCN_HDL (void *)0xbeefcafe
13 
dlopen(const char * file,int flag)14 static inline void *dlopen(const char *file, int flag)
15 {
16 	if (file == NULL)
17 		return _FAKE_DLFCN_HDL;
18 	else
19 		return NULL;
20 }
21 
22 void *_dlsym(const char *sym);
dlsym(void * handle,const char * sym)23 static inline void *dlsym(void *handle, const char *sym)
24 {
25 	if (handle != _FAKE_DLFCN_HDL)
26 		return NULL;
27 	return _dlsym(sym);
28 }
29 
dlerror(void)30 static inline char *dlerror(void)
31 {
32 	return NULL;
33 }
34 
dlclose(void * handle)35 static inline int dlclose(void *handle)
36 {
37 	return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
38 }
39 
40 #endif
41