diff options
-rw-r--r-- | api/api.h | 12 | ||||
-rw-r--r-- | core/Makefile | 20 | ||||
-rw-r--r-- | core/main.cpp | 7 | ||||
-rw-r--r-- | modules/example/Makefile | 20 | ||||
-rw-r--r-- | modules/example/main.cpp | 27 |
5 files changed, 80 insertions, 6 deletions
@@ -3,6 +3,18 @@ #ifdef __cplusplus extern "C" { #endif + +struct PluginInfo +{ +// DWORD dwPluginType; //unused for now + char *szPluginName; +}; + +struct HostInfo +{ + DWORD dwVersion; +}; + __declspec(dllexport) void GetPluginInfo(PluginInfo* pPluginInfo, DWORD *pdwResult); __declspec(dllexport) void PluginHandler(DWORD dwCode, HostInfo *pHostInfo, DWORD *pdwResult); #ifdef __cplusplus diff --git a/core/Makefile b/core/Makefile new file mode 100644 index 0000000..e5568e1 --- /dev/null +++ b/core/Makefile @@ -0,0 +1,20 @@ +CFLAGS=-O2 -msse -fomit-frame-pointer -pipe -mwindows -mwin32 -D DEBUG -I../api/ +CXXFLAGS=${CFLAGS} +LDFLAGS=-Wl,-O1 -static-libgcc +CPPFLAGS = +CC=i686-pc-mingw32-gcc +CXX=i686-pc-mingw32-g++ +STRIP=i686-pc-mingw32-strip +LD=i686-pc-mingw32-ld +LNK_COMMON= +MAINOBJS=main.o + +all: main +main: $(MAINOBJS) + $(CXX) $(MAINOBJS) $(LNK_COMMON) $(LDFLAGS) -o core.exe + #$(STRIP) core.exe + #upx -9 core.exe +clean: + rm *.o + rm core.exe + diff --git a/core/main.cpp b/core/main.cpp index 61e7579..5bb4925 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -1,10 +1,11 @@ #include <windows.h> -#include "../api/api.h" +#include <api.h> + +typedef void (*GetPluginInfoType)(PluginInfo*); +typedef void (*PluginHandlerType)(HostInfo*); int main() { return 0; } - - diff --git a/modules/example/Makefile b/modules/example/Makefile new file mode 100644 index 0000000..cdb01c8 --- /dev/null +++ b/modules/example/Makefile @@ -0,0 +1,20 @@ +CFLAGS=-O2 -msse -fomit-frame-pointer -pipe -mdll -mwindows -I../../api/ -D DEBUG +CXXFLAGS=${CFLAGS} +LDFLAGS=-Wl,-O1 -shared -static-libgcc +CPPFLAGS = +CC=i686-pc-mingw32-gcc +CXX=i686-pc-mingw32-g++ +STRIP=i686-pc-mingw32-strip +LD=i686-pc-mingw32-ld +LNK_COMMON= +MAINOBJS=main.o + +all: main +main: $(MAINOBJS) + $(CXX) $(MAINOBJS) $(LNK_COMMON) $(LDFLAGS) -o example.dll + #$(STRIP) example.dll + #upx -9 example.dll +clean: + rm *.o + rm example.dll + diff --git a/modules/example/main.cpp b/modules/example/main.cpp index 3ba6fb5..7194f72 100644 --- a/modules/example/main.cpp +++ b/modules/example/main.cpp @@ -1,13 +1,34 @@ #include <windows.h> -#include "../api/api.h" +#include <api.h> HINSTANCE hDllInstance=NULL; -BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, -LPVOID lpReserved ) +BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) //default dll entry point { if (ul_reason_for_call == DLL_PROCESS_ATTACH) hDllInstance = (HINSTANCE)hModule; return TRUE; } +void GetPluginInfo(PluginInfo* pPluginInfo, DWORD *pdwResult) +{ + pPluginInfo->szPluginName = (char*)"Simple Plugin example"; + *pdwResult=0; +} +void PluginHandler(DWORD dwCode,HostInfo *pHostInfo,DWORD *pdwResult) +{ + switch(dwCode) + { + case 1: + //первое действие + *pdwResult=1; + break; + case 2: + //второе действие + *pdwResult=1; + break; + default: + *pdwResult=0; + } +} + |