ModuleCountBase.h (647B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include <wrl\module.h> 5 6 namespace AppInstaller::WinRT 7 { 8 // Implements module count interactions. 9 struct ModuleCountBase 10 { 11 ModuleCountBase() 12 { 13 if (auto modulePtr = ::Microsoft::WRL::GetModuleBase()) 14 { 15 modulePtr->IncrementObjectCount(); 16 } 17 } 18 19 ~ModuleCountBase() 20 { 21 if (auto modulePtr = ::Microsoft::WRL::GetModuleBase()) 22 { 23 modulePtr->DecrementObjectCount(); 24 } 25 } 26 }; 27 }