]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/dynamic.h
Move Blocking/NonBlocking to socket.cpp and make inline
[user/henk/code/inspircd.git] / include / dynamic.h
index 98deaf7613e7b8d43a3c52b377045392bd79bca7..a8b7392bf73e547e65b3fe1afa0b12d16d24662c 100644 (file)
@@ -22,6 +22,8 @@ typedef void * (initfunc) (void);
 
 #include "inspircd_config.h"
 
+extern void do_log(int, const char*, ...);
+
 class DLLManager
 {
  public:
@@ -61,21 +63,21 @@ class DLLFactoryBase : public DLLManager
 #endif
 };
 
-
 template <class T> class DLLFactory : public DLLFactoryBase
 {
  public:
        DLLFactory(const char *fname, const char *func_name=0) : DLLFactoryBase(fname,func_name)
        {
-               if (!err && factory_func)
-                       factory = (T*)factory_func();
+               if (factory_func)
+                       factory = reinterpret_cast<T*>(factory_func());
                else
-                       factory = 0;
+                       factory = reinterpret_cast<T*>(-1);
        }
        
        ~DLLFactory()
        {
-               delete factory;
+               if (factory)
+                       delete factory;
        }
 
        T *factory;