summaryrefslogtreecommitdiffstats
path: root/src/common/win32/dlfcn.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/win32/dlfcn.cc')
-rw-r--r--src/common/win32/dlfcn.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/common/win32/dlfcn.cc b/src/common/win32/dlfcn.cc
new file mode 100644
index 000000000..329d14677
--- /dev/null
+++ b/src/common/win32/dlfcn.cc
@@ -0,0 +1,38 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2020 SUSE LINUX GmbH
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include <sstream>
+#include <windows.h>
+
+#include "common/errno.h"
+#include "include/dlfcn_compat.h"
+
+
+void* dlopen(const char *filename, int flags) {
+ return LoadLibrary(filename);
+}
+
+int dlclose(void* handle) {
+ //FreeLibrary returns 0 on error, as opposed to dlclose.
+ return !FreeLibrary(handle);
+}
+
+void* dlsym(void* handle, const char* symbol) {
+ return (void*)GetProcAddress(handle, symbol);
+}
+
+dl_errmsg_t dlerror() {
+ return win32_lasterror_str();
+}
+