- // Try to open the library now and get any error message.
-
- h=dlopen( fname, RTLD_NOW );
- err=dlerror();
+ err = NULL;
+
+ if (!strstr(fname,".so"))
+ {
+ err = "This doesn't look like a module file to me...";
+ return;
+ }
+#ifdef STATIC_LINK
+ this->staticname[0] = '\0';
+ for (int j = 0; modsyms[j].name; j++)
+ {
+ if (!strcmp(modsyms[j].name,fname))
+ {
+ strlcpy(this->staticname,fname,1020);
+ err = 0;
+ return;
+ }
+ }
+ err = "Module is not statically compiled into the ircd";
+#else
+ h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
+ if (!h)
+ {
+ err = (char*)dlerror();
+ return;
+ }
+#endif