2007-07-16 17:30:04 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2009-01-02 18:16:05 +00:00
|
|
|
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
|
2009-03-15 12:42:35 +00:00
|
|
|
* See: http://wiki.inspircd.org/Credits
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
|
|
|
* This program is free but copyrighted software; see
|
|
|
|
* the file COPYING for details.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DLL_H
|
|
|
|
#define __DLL_H
|
|
|
|
|
2009-10-12 22:56:41 +00:00
|
|
|
class Module;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** The DLLManager class is able to load a module file by filename,
|
|
|
|
* and locate its init_module symbol.
|
|
|
|
*/
|
2009-09-30 03:22:25 +00:00
|
|
|
class CoreExport DLLManager : public classbase
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2007-08-28 18:47:55 +00:00
|
|
|
protected:
|
2009-10-12 22:56:41 +00:00
|
|
|
/** The last error string
|
2007-08-28 18:47:55 +00:00
|
|
|
*/
|
2009-10-12 22:56:41 +00:00
|
|
|
std::string err;
|
2009-02-14 21:14:36 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
public:
|
|
|
|
/** This constructor loads the module using dlopen()
|
|
|
|
* @param fname The filename to load. This should be within
|
|
|
|
* the modules dir.
|
|
|
|
*/
|
2009-09-26 14:13:13 +00:00
|
|
|
DLLManager(const char *fname);
|
2007-07-16 17:30:04 +00:00
|
|
|
virtual ~DLLManager();
|
|
|
|
|
|
|
|
/** Get the last error from dlopen() or dlsym().
|
|
|
|
*/
|
2009-10-12 22:56:41 +00:00
|
|
|
const std::string& LastError()
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2009-10-12 22:56:41 +00:00
|
|
|
/** The module library handle.
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
|
|
|
void *h;
|
2009-02-14 21:14:36 +00:00
|
|
|
|
2009-10-12 22:56:41 +00:00
|
|
|
/** Return a module by calling the init function
|
2007-08-28 18:47:55 +00:00
|
|
|
*/
|
2009-10-12 22:56:41 +00:00
|
|
|
Module* callInit();
|
2007-07-16 17:30:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2008-09-20 21:14:25 +00:00
|
|
|
|