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.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/plugins/example/main.cpp b/plugins/example/main.cpp
new file mode 100644
index 0000000..c435207
--- /dev/null
+++ b/plugins/example/main.cpp
@@ -0,0 +1,59 @@
+
+#include <wx/wx.h>
+
+#include <pluginapi.h> //this is necessary, PLUGININFO structure, other related to load/unload plugin code
+
+
+PLUGINLINK *pluginLink;
+
+ class wxPluginForEvilCore: public wxApp //this is like on default wxwidgets application
+ {
+ virtual bool OnInit();
+ };
+
+ IMPLEMENT_APP_NO_MAIN(wxPluginForEvilCore) //main() does not needed, we will create instance by hand later
+
+
+
+/*HINSTANCE hInst;
+BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) //default dll entry point
+{
+ hInst = hinstDLL;
+ return TRUE;
+}*/ //windows specific, does not needed ?
+
+PLUGININFO pluginInfo =
+{
+ sizeof(PLUGININFO), //size of structure
+ (wchar_t*)L"example plugin", //name
+ 0, //description
+ 0, //author
+ 0, //author email
+ 0x00010101 //version 0.1.1.1
+};
+
+extern "C" PLUGININFO* SetPluginInfo()
+{
+ return &pluginInfo; //necessary, our plugin info for core can recognize us
+}
+
+extern "C" int Load(PLUGINLINK *link) //basic initialisation, registering new functions, do other basic initialisation, you can create infinite loop, or other code which use many time here, only fast basic initialisation
+{
+ pluginLink = link; //necessary
+ //some basic initialisation code
+ return 0; //all ok, retrun 0
+}
+
+extern "C" int OnModulesLoaded() //load main code from here, all services from other plugins must be avaible here
+{
+ wxApp::SetInstance(new wxPluginForEvilCore()); //create instance, i think here is right place, not in load where we do only basic initialisation
+// wxEntry(GetModuleHandle(NULL),NULL,NULL,SW_SHOW); //here we need to get module handle somehow, commented string is for windows only
+
+ return 0;
+}
+extern "C" int Unload()
+{
+ //do some cleanup on exit
+ return 0;
+}
+