blob: c54f8d8e8de362e47ad380bdd9b58c039f28dca2 [file] [log] [blame]
Mike Frysingerf2e27cf2009-11-06 06:09:22 -05001/*
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
Stephen Hemmingere7b24b62013-03-13 08:29:59 -070011#define RTLD_GLOBAL 1
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050012#define _FAKE_DLFCN_HDL (void *)0xbeefcafe
13
14static 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
22extern void *_dlsym(const char *sym);
23static inline void *dlsym(void *handle, const char *sym)
24{
25 if (handle != _FAKE_DLFCN_HDL)
26 return NULL;
27 return _dlsym(sym);
28}
29
30static inline char *dlerror(void)
31{
32 return NULL;
33}
34
35static inline int dlclose(void *handle)
36{
37 return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
38}
39
40#endif