diff options
-rw-r--r-- | api/pluginapi.h | 1 | ||||
-rw-r--r-- | plugins/example/example.cbp | 41 | ||||
-rw-r--r-- | plugins/example/main.cpp | 59 |
3 files changed, 101 insertions, 0 deletions
diff --git a/api/pluginapi.h b/api/pluginapi.h index 9b89b66..274db17 100644 --- a/api/pluginapi.h +++ b/api/pluginapi.h @@ -19,6 +19,7 @@ typedef struct typedef struct { + int size; wchar_t *name, *description, *author, *authoremail; unsigned long version; diff --git a/plugins/example/example.cbp b/plugins/example/example.cbp new file mode 100644 index 0000000..64c5694 --- /dev/null +++ b/plugins/example/example.cbp @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="example" /> + <Option pch_mode="2" /> + <Option compiler="gcc" /> + <Build> + <Target title="Debug"> + <Option output="bin/Debug/example" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj/Debug/" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-g" /> + </Compiler> + </Target> + <Target title="Release"> + <Option output="bin/Release/example" prefix_auto="1" extension_auto="1" /> + <Option object_output="obj/Release/" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Compiler> + <Add option="-O2" /> + </Compiler> + <Linker> + <Add option="-s" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + </Compiler> + <Extensions> + <envvars /> + <code_completion /> + <debugger /> + <lib_finder disable_auto="1" /> + </Extensions> + </Project> +</CodeBlocks_project_file> 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; +} + |