]> git.proxmox.com Git - mirror_iproute2.git/blob - include/dlfcn.h
Merge branch 'strict-dumps' into iproute2-next
[mirror_iproute2.git] / include / dlfcn.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Stub dlfcn implementation for systems that lack shared library support
4 * but obviously can still reference compiled-in symbols.
5 */
6
7 #ifndef NO_SHARED_LIBS
8 #include_next <dlfcn.h>
9 #else
10
11 #define RTLD_LAZY 0
12 #define RTLD_GLOBAL 1
13 #define _FAKE_DLFCN_HDL (void *)0xbeefcafe
14
15 static inline void *dlopen(const char *file, int flag)
16 {
17 if (file == NULL)
18 return _FAKE_DLFCN_HDL;
19 else
20 return NULL;
21 }
22
23 void *_dlsym(const char *sym);
24 static inline void *dlsym(void *handle, const char *sym)
25 {
26 if (handle != _FAKE_DLFCN_HDL)
27 return NULL;
28 return _dlsym(sym);
29 }
30
31 static inline char *dlerror(void)
32 {
33 return NULL;
34 }
35
36 static inline int dlclose(void *handle)
37 {
38 return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
39 }
40
41 #endif