- DLLFactory(InspIRCd* Instance, const char *fname, const char *func_name)
- : DLLManager(Instance, fname), init_func(NULL), ServerInstance(Instance)
- {
- const char* error = LastError();
-
- if(!error)
- {
- if(!GetSymbol((void **)&init_func, func_name))
- {
- throw FindSymbolException("Missing " + std::string(func_name) + "() entrypoint!");
- }
- }
- else
- {
- throw LoadModuleException(error);
- }
- }
-
- /** Calls the 'init_module' C exported function within a module, which
- * returns a pointer to a Module derived object.
- */
- ReturnType* CallInit()
- {
- if(init_func)
- {
- return init_func(ServerInstance);
- }
- else
- {
- return NULL;
- }
- }
-
- /** The destructor deletes the ModuleFactory pointer.
+ void* GetSymbol(const char* name) const;
+
+ /** Retrieves the value of the specified symbol and casts it to the requested type.
+ * @param name The name of the symbol to retrieve.
+ * @return Either the value of the specified symbol or or NULL if it does not exist.