summaryrefslogtreecommitdiff
path: root/modules.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules.c')
-rw-r--r--modules.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/modules.c b/modules.c
index 0598a1a22..99b40bc49 100644
--- a/modules.c
+++ b/modules.c
@@ -14,18 +14,27 @@
#include "modules.h"
#include "language.h"
-/*
- * Disable the modules on OpenBSD (for now)
- * there is work in progress for this.
- */
#ifdef __OpenBSD__
-#ifdef USE_MODULES
-#undef USE_MODULES
-#endif /* USE_MODULES */
+#define DL_PREFIX "_" /* so OpenBSD can lookup the symbols */
+#else
+#define DL_PREFIX ""
#endif /* __OpenBSD__ */
#ifdef USE_MODULES
#include <dlfcn.h>
+/* Define these for systems without them */
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#ifndef RTLD_LAZY
+#define RTLD_LAZY RTLD_NOW
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_LOCAL
+#define RTLD_LOCAL 0
+#endif
#endif
/**
@@ -348,7 +357,7 @@ int loadModule(Module * m, User * u)
return MOD_ERR_NOLOAD;
}
- func = dlsym(m->handle, "AnopeInit");
+ func = dlsym(m->handle, DL_PREFIX "AnopeInit");
if ((err = dlerror()) != NULL) {
dlclose(m->handle); /* If no AnopeInit - it isnt an Anope Module, close it */
return MOD_ERR_NOLOAD;
@@ -400,7 +409,7 @@ int unloadModule(Module * m, User * u)
return MOD_ERR_UNKNOWN;
}
- func = dlsym(m->handle, "AnopeFini");
+ func = dlsym(m->handle, DL_PREFIX "AnopeFini");
if (func) {
func(); /* exec AnopeFini */
}