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 _FAKE_DLFCN_HDL (void *)0xbeefcafe 12 13static inline void *dlopen(const char *file, int flag) 14{ 15 if (file == NULL) 16 return _FAKE_DLFCN_HDL; 17 else 18 return NULL; 19} 20 21extern void *_dlsym(const char *sym); 22static inline void *dlsym(void *handle, const char *sym) 23{ 24 if (handle != _FAKE_DLFCN_HDL) 25 return NULL; 26 return _dlsym(sym); 27} 28 29static inline char *dlerror(void) 30{ 31 return NULL; 32} 33 34static inline int dlclose(void *handle) 35{ 36 return (handle == _FAKE_DLFCN_HDL) ? 0 : 1; 37} 38 39#endif 40