summaryrefslogtreecommitdiff
path: root/core/modules.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-10-15 07:30:39 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-10-15 07:30:39 +0300
commit076c9cfcf33e06218805ad0412a806005c3c63f7 (patch)
treea2038b043736beee85e012bce34f960d70ad6d74 /core/modules.cpp
parentbd197c2ad7e360fb8008c50f8d423072926428dd (diff)
lord_evil, i was made plugin example for you, coz i know, you are to lazy to read docs ;)
Diffstat (limited to 'core/modules.cpp')
-rw-r--r--core/modules.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/modules.cpp b/core/modules.cpp
index d094311..b509c6f 100644
--- a/core/modules.cpp
+++ b/core/modules.cpp
@@ -2,6 +2,8 @@
std::list<plugin*> plugins;
+extern PLUGINLINK pluglink;
+
void load_modules()
{
wxStandardPaths *pth = new wxStandardPaths;
@@ -50,7 +52,10 @@ void load_modules()
lib_path += filename;
wxDynamicLibrary *plug = new wxDynamicLibrary(lib_path);
if(!plug->IsLoaded())
+ {
wxMessageBox(_T("Failed to load plugin") ,_T("Error"), wxOK | wxICON_ERROR);
+ wxLogDebug(_T("Failed to load plugin\n"));
+ }
bool is_plugin = true;
plugin::exported_functions_s *funcs = new plugin::exported_functions_s;
if((funcs->Load = (load)plug->GetSymbol(_T("load"))) == NULL)
@@ -74,6 +79,15 @@ void load_modules()
while(dir.GetNext(&filename));
}
+void run_plugins()
+{
+ if(!plugins.empty())
+ for(std::list<plugin*>::iterator i = plugins.begin(); i != plugins.end(); i++)
+ {
+ (*i)->get_exported_functions()->Load(&pluglink);
+ (*i)->get_exported_functions()->OnModulesLoaded();
+ }
+}
plugin::plugin(wxDynamicLibrary *lib, PLUGININFO *info, exported_functions_s *funcs)
{
@@ -84,3 +98,7 @@ plugin::plugin(wxDynamicLibrary *lib, PLUGININFO *info, exported_functions_s *fu
if(funcs)
exported_funcs = funcs;
}
+const plugin::exported_functions_s* plugin::get_exported_functions()
+{
+ return exported_funcs;
+}