+
+void newserv_shutdown() {
+ module *mods;
+ char buf[1024];
+
+ while (modules.cursi) {
+ mods=(module *)(modules.content);
+
+ strlcpy(buf, mods[0].name->content, sizeof(buf));
+
+ /* Unload the module unless we're running on Valgrind -
+ * in which case unloading the module would invalidate
+ * stacktraces Valgrind has captured so far. */
+ rmmod(buf, !RUNNING_ON_VALGRIND);
+ }
+
+ clearmoduledeps();
+
+ if (moddir!=NULL)
+ freesstring(moddir);
+
+ if (modsuffix!=NULL)
+ freesstring(modsuffix);
+
+ Error("core",ERR_INFO,"All modules removed. Exiting.");
+}
+
+/* very slow, make sure you cache the pointer! */
+void *ndlsym(char *modulename, char *fn) {
+ module *mods=(module *)(modules.content);
+ int i=getindex(modulename);
+
+ if (i<0)
+ return NULL;
+
+ return dlsym(mods[i].handle, fn);
+}