www.gusucode.com > VC++动态链接库DLL操作实例-源码程序 > VC++动态链接库DLL操作实例-源码程序/code/如何在DLL中共享数据/Test/Test.cpp
//Download by http://www.NewXing.com // Test.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include "Test.h" #pragma data_seg(".SharedData") int nCount = 0; #pragma data_seg() BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: nCount++; break; case DLL_PROCESS_DETACH: nCount--; break; default: break; } return TRUE; } int GetCount() { return nCount; }