From 84472069ba939536eeb10b442b935eb5c98bf879 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 17 Jun 2007 13:04:25 +0000 Subject: Module factory and init function in modules turned into a neat macro: INIT_MODULE(MyModuleClassName); Get cracking, w00t :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7341 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/modules.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/modules.h b/include/modules.h index b94abfbbc..332f2b812 100644 --- a/include/modules.h +++ b/include/modules.h @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -1608,4 +1608,20 @@ typedef std::vector ModuleList; */ typedef std::vector FactoryList; + +#define MODULE_INIT(y) \ + class Factory : public ModuleFactory \ + { \ + public: \ + virtual Module * CreateModule(InspIRCd* Me) \ + { \ + return new y(Me); \ + } \ + }; \ + extern "C" DllExport void * init_module(void) \ + { \ + return new Factory; \ + } + #endif + -- cgit v1.2.3