X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fdynamic.cpp;h=ebaaa5191ace59dd337ff18faf8834def42a0203;hb=235864add961270140c956647d783fa79b5f7120;hp=b993b8af579d8d8026ec56b8e92d1aab0162ce96;hpb=060f4034303f798ee0a55a926c2c2a120b865df4;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/dynamic.cpp b/src/dynamic.cpp index b993b8af5..ebaaa5191 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * InspIRCd: (C) 2002-2010 InspIRCd Development Team * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see @@ -11,8 +11,6 @@ * --------------------------------------------------- */ -/* $Core */ - #include "inspircd.h" #include "dynamic.h" #ifndef WIN32 @@ -28,7 +26,7 @@ DLLManager::DLLManager(const char *fname) return; } - h = dlopen(fname, RTLD_NOW|RTLD_LOCAL|RTLD_NODELETE); + h = dlopen(fname, RTLD_NOW|RTLD_LOCAL); if (!h) { err = dlerror(); @@ -47,13 +45,13 @@ union init_t { Module* (*fptr)(); }; -Module* DLLManager::callInit() +Module* DLLManager::CallInit() { if (!h) return NULL; init_t initfn; - initfn.vptr = dlsym(h, "init_module"); + initfn.vptr = dlsym(h, MODULE_INIT_STR); if (!initfn.vptr) { err = dlerror(); @@ -62,3 +60,14 @@ Module* DLLManager::callInit() return (*initfn.fptr)(); } + +std::string DLLManager::GetVersion() +{ + if (!h) + return ""; + + const char* srcver = (char*)dlsym(h, "inspircd_src_version"); + if (srcver) + return srcver; + return "Unversioned module"; +}