]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/dynamic.h
Bump the ABI version.
[user/henk/code/inspircd.git] / include / dynamic.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2013, 2019 Sadie Powell <sadie@witchery.services>
5  *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
6  *   Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
7  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
8  *   Copyright (C) 2007 Oliver Lupton <om@inspircd.org>
9  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
10  *   Copyright (C) 2006 Craig Edwards <brain@inspircd.org>
11  *
12  * This file is part of InspIRCd.  InspIRCd is free software: you can
13  * redistribute it and/or modify it under the terms of the GNU General Public
14  * License as published by the Free Software Foundation, version 2.
15  *
16  * This program is distributed in the hope that it will be useful, but WITHOUT
17  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19  * details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23  */
24
25
26 #pragma once
27
28 /** The DLLManager class is able to load a module file by filename,
29  * and locate its init_module symbol.
30  */
31 class CoreExport DLLManager : public classbase
32 {
33  protected:
34         /** The last error string
35          */
36         std::string err;
37
38         /** Sets the last error string
39         */
40         void RetrieveLastError();
41
42  public:
43         /** This constructor loads the module using dlopen()
44          * @param fname The filename to load. This should be within
45          * the modules dir.
46          */
47         DLLManager(const char *fname);
48         virtual ~DLLManager();
49
50         /** Get the last error from dlopen() or dlsym().
51          */
52         const std::string& LastError()
53         {
54                  return err;
55         }
56
57         /** The module library handle.
58          */
59         void *h;
60
61         /** Return a module by calling the init function
62          */
63         Module* CallInit();
64
65         /** Retrieves the value of the specified symbol.
66          * @param name The name of the symbol to retrieve.
67          * @return Either the value of the specified symbol or or NULL if it does not exist.
68          */
69         void* GetSymbol(const char* name);
70
71         /** Get detailed version information from the module file */
72         std::string GetVersion();
73 };