ShareMemory_Type.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 下列 ifdef 块是创建使从 DLL 导出更简单的
  2. // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 SHAREMEMORY_TYPE_EXPORTS
  3. // 符号编译的。在使用此 DLL 的
  4. // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
  5. // SHAREMEMORY_TYPE_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
  6. // 符号视为是被导出的。
  7. #ifndef SHAREMEMORY_TYPE_EXPORTS
  8. #ifdef WIN_64BIT
  9. #ifdef _DEBUG
  10. #pragma comment(lib, "ShareMemory_TypeX64D.lib")
  11. #else
  12. #pragma comment(lib, "ShareMemory_TypeX64.lib")
  13. #endif
  14. #else
  15. #ifdef _DEBUG
  16. #pragma comment(lib, "ShareMemory_TypeD.lib")
  17. #else
  18. #pragma comment(lib, "ShareMemory_Type.lib")
  19. #endif
  20. #endif
  21. #endif
  22. #ifdef SHAREMEMORY_TYPE_EXPORTS
  23. #define SHAREMEMORY_TYPE_API __declspec(dllexport)
  24. #define SHAREMEMORY_TYPE_C_API extern "C" __declspec(dllexport)
  25. #else
  26. #define SHAREMEMORY_TYPE_API __declspec(dllimport)
  27. #define SHAREMEMORY_TYPE_C_API extern "C" __declspec(dllimport)
  28. #endif
  29. #include"ShareMemory_Common.h"
  30. // 此类是从 ShareMemory_Type.dll 导出的
  31. class SHAREMEMORY_TYPE_API CShareMemory_Type {
  32. BYTE m_type;
  33. unsigned int m_BlockDataSize;
  34. unsigned int m_BlockCount;
  35. unsigned int m_BlockHeadSize;
  36. SHRAREMEMBLOCKID m_SMBid;
  37. SMClientID m_SMCid;
  38. public:
  39. CShareMemory_Type(BYTE type, unsigned int BlockDataSize, unsigned int BlockCount, unsigned int BlockHeadSize);
  40. ~CShareMemory_Type();
  41. bool GetBlockData(DWORD SMBid, LPVOID & buff, DWORD & size);
  42. };
  43. extern SHAREMEMORY_TYPE_API int nShareMemory_Type;
  44. SHAREMEMORY_TYPE_API int fnShareMemory_Type(void);