summaryrefslogtreecommitdiff
path: root/plugins/example/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/example/main.cpp')
-rw-r--r--plugins/example/main.cpp14
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], "");