diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-02 10:04:03 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-02 10:04:03 +0300 |
commit | 8ac279eaac75a07ae7d303ed4dc6dd3df98425c1 (patch) | |
tree | e2a5b79feecc920b9e7fba82bcdefeea53d198a5 | |
parent | f7b3a636db0db493a70e8277fc8a444d3ac7f7e5 (diff) |
modified: core/main.cpp
modified: core/plugin.h
modified: modules/example/main.cpp
-rw-r--r-- | core/main.cpp | 9 | ||||
-rw-r--r-- | core/plugin.h | 2 | ||||
-rw-r--r-- | modules/example/main.cpp | 7 |
3 files changed, 15 insertions, 3 deletions
diff --git a/core/main.cpp b/core/main.cpp index 3438d66..7e7586d 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -25,11 +25,15 @@ int main(int argc, char *argv[]) { if(LoadModules()) return 1; //something wrong - for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) + for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) //initializing plugins { - cout<<"Loaded plugin: "<<(*p)->getName()<<'\n'; (*p)->getFuncs().load(&link); } + for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) + { + if((*p)->getFuncs().loaded) + (*p)->getFuncs().loaded(); + } // CreateServiceFunction("GetPluginInfoList", GetPluginInfoList); for(;;) Sleep(1000); @@ -52,6 +56,7 @@ int LoadModules() hPlugin = LoadLibraryA(tmp); funcs.info = (SetPluginInfo)GetProcAddress(hPlugin, "SetPluginInfo"); funcs.load = (Load)GetProcAddress(hPlugin, "Load"); + funcs.loaded = (OnModulesLoaded)GetProcAddress(hPlugin, "OnModulesLoaded"); if(funcs.info && funcs.load) { PLUGININFO *pi = funcs.info(); diff --git a/core/plugin.h b/core/plugin.h index 01e59c9..f79c2de 100644 --- a/core/plugin.h +++ b/core/plugin.h @@ -6,6 +6,7 @@ typedef PLUGININFO * (__cdecl * SetPluginInfo) (); typedef int (__cdecl * Load) (PLUGINLINK *link); +typedef int (__cdecl * OnModulesLoaded) (); class plugin { @@ -14,6 +15,7 @@ public: { SetPluginInfo info; Load load; + OnModulesLoaded loaded; }; const HMODULE getHmodule(); const exported_funcs_s getFuncs(); diff --git a/modules/example/main.cpp b/modules/example/main.cpp index f765cab..7d4b75d 100644 --- a/modules/example/main.cpp +++ b/modules/example/main.cpp @@ -31,7 +31,12 @@ extern "C" __declspec(dllexport) PLUGININFO* SetPluginInfo() extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; //necessary - MessageBoxA(0, "Plugin Example Succesful loaded", "INFO", MB_OK); + MessageBoxA(0, "Simple plugin initialisation done", "INFO", MB_OK); return 0; //all ok, retrun 0 } +extern "C" int __declspec(dllexport) OnModulesLoaded() +{ + MessageBoxA(0, "Advanced plugin features needed services from other plugins are working from now", "INFO", MB_OK); + return 0; +} |