--- /dev/null
+#include "internal_libdl.h"
+
+// private libc interface
+#define __RTLD_DLOPEN 0x80000000
+extern "C" void *__libc_dlopen_mode(const char * filename, int flag);
+extern "C" void *__libc_dlsym(void *handle, const char *symbol);
+extern "C" int __libc_dlclose(void *handle);
+
+namespace __swap {
+namespace internal {
+
+void *dlopen(const char *filename, int flag) noexcept
+{
+ return __libc_dlopen_mode(filename, __RTLD_DLOPEN | flag);
+}
+
+void *dlsym(void *handle, const char *symbol) noexcept
+{
+ return __libc_dlsym(handle, symbol);
+}
+
+int dlclose(void *handle) noexcept
+{
+ return __libc_dlclose(handle);
+}
+
+} // namespace internal
+} // namespace __swap
--- /dev/null
+#ifndef INTERNAL_LIBDL_H
+#define INTERNAL_LIBDL_H
+
+#include <dlfcn.h> // RTLD_* flags
+
+namespace __swap {
+namespace internal {
+
+void *dlopen(const char *filename, int flag) noexcept;
+void *dlsym(void *handle, const char *symbol) noexcept;
+int dlclose(void *handle) noexcept;
+
+} // namespace internal
+} // namespace __swap
+
+#endif // INTERNAL_LIBDL_H