File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,17 @@ namespace winrt::impl
108108 return 0U ;
109109 }();
110110
111+ // This pragma is used to detect if the translation unit containing regfree usage is being linked with another translation
112+ // unit that declared WINRT_NEVER_REG_FREE.
113+ #pragma detect_mismatch("WINRT_REG_FREE", "enabled")
111114#endif // WINRT_REG_FREE
112115
116+ #ifdef WINRT_NEVER_REG_FREE
117+ // This pragma is used to ensure that a binary will never have winrt regfree logic enabled. Defining WINRT_NEVER_REG_FREE will
118+ // cause this pragma to break linkage if any translation units in the same binary defined WINRT_REG_FREE.
119+ #pragma detect_mismatch("WINRT_REG_FREE", "never")
120+ #endif // WINRT_NEVER_REG_FREE
121+
113122 template <typename Interface>
114123 hresult get_runtime_activation_factory (param::hstring const & name, void ** result) noexcept
115124 {
Original file line number Diff line number Diff line change 11#include " pch.h"
22#include " winrt/test_component.h"
33
4- #ifdef WINRT_REG_FREE
5- #error "This test needs WINRT_REG_FREE to be undefined"
6- #endif
7-
84using namespace winrt ;
95using namespace Windows ::Foundation;
106using namespace test_component ;
Original file line number Diff line number Diff line change 33#pragma warning(4: 4458) // ensure we compile clean with this warning enabled
44
55#define WINRT_LEAN_AND_MEAN
6+ #define WINRT_NEVER_REG_FREE
67#include < unknwn.h>
78#include " winrt/Windows.Data.Json.h"
89#include " winrt/Windows.Foundation.h"
You can’t perform that action at this time.
0 commit comments