]> git.proxmox.com Git - mirror_iproute2.git/blame - include/dlfcn.h
Merge branch 'master' of git://git.kernel.org/pub/scm/network/iproute2/iproute2-next
[mirror_iproute2.git] / include / dlfcn.h
CommitLineData
6054c1eb 1/* SPDX-License-Identifier: GPL-2.0 */
f2e27cfb
MF
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
e7b24b67 12#define RTLD_GLOBAL 1
f2e27cfb
MF
13#define _FAKE_DLFCN_HDL (void *)0xbeefcafe
14
15static 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
892e2124 23void *_dlsym(const char *sym);
f2e27cfb
MF
24static inline void *dlsym(void *handle, const char *sym)
25{
26 if (handle != _FAKE_DLFCN_HDL)
27 return NULL;
28 return _dlsym(sym);
29}
30
31static inline char *dlerror(void)
32{
33 return NULL;
34}
35
36static inline int dlclose(void *handle)
37{
38 return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
39}
40
41#endif