SHOW:
|
|
- or go back to the newest paste.
| 1 | - | /* Replace "dll.h" with the name of your header */ |
| 1 | + | #ifndef _DLL_H_ |
| 2 | - | #include <windows.h> |
| 2 | + | #define _DLL_H_ |
| 3 | - | #include <cstring> |
| 3 | + | |
| 4 | - | #include <iostream> |
| 4 | + | #if BUILDING_DLL |
| 5 | - | #include "dll.h" |
| 5 | + | # define DLLIMPORT __declspec (dllexport) |
| 6 | #else /* Not BUILDING_DLL */ | |
| 7 | # define DLLIMPORT __declspec (dllimport) | |
| 8 | - | using namespace std; |
| 8 | + | #endif /* Not BUILDING_DLL */ |
| 9 | /* | |
| 10 | - | void Add (int a, int b , int & res) |
| 10 | + | extern char* Exports[]; |
| 11 | - | {
|
| 11 | + | |
| 12 | - | res = a+b; |
| 12 | + | extern "C" int __declspec(dllexport) GetPluginABIVersion(); |
| 13 | extern "C" int __declspec(dllexport) GetFunctionCount(); | |
| 14 | - | } |
| 14 | + | extern "C" int __declspec(dllexport) GetFunctionInfo(int index, void*& address, char*& def); |
| 15 | */ | |
| 16 | - | static char* exports[] = {
|
| 16 | + | |
| 17 | - | (char*)"Add",(char*)"procedure Add(a ,b :integer; var result : integer);" |
| 17 | + | extern "C" bool DllMain(HINSTANCE, int, void*) __attribute__((stdcall)); |
| 18 | - | }; |
| 18 | + | |
| 19 | //These are intended for use with the SCAR/Simba plugin loaders, and nothing else. | |
| 20 | - | #define NumExports 1 |
| 20 | + | extern "C" int GetPluginABIVersion() __attribute__((stdcall)); |
| 21 | - | HMODULE dllinst; |
| 21 | + | extern "C" int GetFunctionCount() __attribute__((stdcall)); |
| 22 | - | //STDCALL - SCAR/Simba |
| 22 | + | extern "C" int GetFunctionInfo(int, void*&, char*&) __attribute__((stdcall)); |
| 23 | - | int GetPluginABIVersion() |
| 23 | + | |
| 24 | - | {
|
| 24 | + | |
| 25 | - | return 2; |
| 25 | + | |
| 26 | - | } |
| 26 | + | #endif /* _DLL_H_ */ |