summaryrefslogtreecommitdiff
path: root/src/win32/dl/dl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32/dl/dl.cpp')
-rw-r--r--src/win32/dl/dl.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/win32/dl/dl.cpp b/src/win32/dl/dl.cpp
new file mode 100644
index 000000000..8d76e1f0d
--- /dev/null
+++ b/src/win32/dl/dl.cpp
@@ -0,0 +1,30 @@
+ /* POSIX emulation layer for Windows.
+ *
+ * Copyright (C) 2008-2011 Anope Team <team@anope.org>
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#include "services.h"
+
+void *dlopen(const char *filename, int)
+{
+ return LoadLibrary(filename);
+}
+
+char *dlerror(void)
+{
+ static Anope::string err = Anope::LastError();
+ SetLastError(0);
+ return err.empty() ? NULL : const_cast<char *>(err.c_str());
+}
+
+void *dlsym(void *handle, const char *symbol)
+{
+ return GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol);
+}
+
+int dlclose(void *handle)
+{
+ return !FreeLibrary(reinterpret_cast<HMODULE>(handle));
+}