diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 21:19:05 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 21:19:05 +0300 |
commit | 6add86d17a430db932bc0dc9af44da5dcb327fec (patch) | |
tree | a8e360a8736b91f9acaa2b94b91c4ea695c128c6 /plugins/example/main.cpp | |
parent | 7991233458276eb1d24617880bed8da52e866889 (diff) |
service usage example
Diffstat (limited to 'plugins/example/main.cpp')
-rw-r--r-- | plugins/example/main.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/example/main.cpp b/plugins/example/main.cpp index 4ca212c..bd1f65b 100644 --- a/plugins/example/main.cpp +++ b/plugins/example/main.cpp @@ -5,8 +5,11 @@ #include <ec_pluginapi.h> //this is necessary, PLUGININFO structure, other related to load/unload plugin code + PLUGINLINK *pluginLink; +#define CallService(service, param) pluginLink->CallService(service,param) + class wxPluginForEvilCore: public wxApp //this is like on default wxwidgets application { virtual bool OnInit(); @@ -17,7 +20,14 @@ PLUGINLINK *pluginLink; bool wxPluginForEvilCore::OnInit() { wxMessageBox(_T("I am a plugin example") ,_T("Info"), wxOK | wxICON_INFORMATION); - return true; + int *core_version = (int*)CallService("EC/GetVersionInt", NULL); //using service implemented somewhere (in core, in plugins, in other place), NULL is data required for service + if(core_version) + { + wxChar msg[32]; + wxSnprintf(msg, 31, _T("Core version is %d."), core_version); + wxMessageBox(msg, _T("Info"), wxOK | wxICON_INFORMATION); + } + return true; } #ifdef _WIN32 @@ -69,7 +79,7 @@ extern "C" int on_modules_loaded() //load main code from here, all services from #ifdef _WIN32 wxEntry(GetModuleHandle(NULL),NULL,NULL,SW_SHOW); #else - int i = 0; + int i = 1; char **params = (char**)malloc(2); params[0] = (char*)malloc(2); strcpy(params[0], ""); |