Skip to content

Commit a3313c3

Browse files
hvladasfernandes
authored andcommitted
This should show value of _MSC_VER when build fails with new version of MSVC.
Note, it is not documented so far for newly released MSVC 17.1.
1 parent 3fe37a6 commit a3313c3

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/common/os/win32/mod_loader.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,34 @@ class ContextActivator
8787
memset(&ackd, 0, sizeof(ackd));
8888
ackd.cbSize = sizeof(ackd);
8989

90-
// if CRT already present in some activation context then nothing to do
91-
if ((*mFindActCtxSectionString)
92-
(0, NULL,
93-
ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
90+
const char* crtDll =
9491
#if _MSC_VER == 1400
95-
"msvcr80.dll",
92+
"msvcr80.dll";
9693
#elif _MSC_VER == 1500
97-
"msvcr90.dll",
94+
"msvcr90.dll";
9895
#elif _MSC_VER == 1600
99-
"msvcr100.dll",
96+
"msvcr100.dll";
10097
#elif _MSC_VER == 1700
101-
"msvcr110.dll",
98+
"msvcr110.dll";
10299
#elif _MSC_VER == 1800
103-
"msvcr120.dll",
100+
"msvcr120.dll";
104101
#elif _MSC_VER >= 1900 && _MSC_VER <= 1930
105-
"vcruntime140.dll",
102+
"vcruntime140.dll";
106103
#else
107-
#error Specify CRT DLL name here !
104+
"";
105+
106+
#define TO_STR(x) #x
107+
#define ERRSTR(x) "Unknown " #x " value: " TO_STR(x) ". Specify CRT DLL name here !"
108+
109+
static_assert(false, ERRSTR(_MSC_VER));
110+
// #error Specify CRT DLL name here !
108111
#endif
109-
&ackd))
112+
113+
// if CRT already present in some activation context then nothing to do
114+
if ((*mFindActCtxSectionString)
115+
(0, NULL,
116+
ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
117+
crtDll, &ackd))
110118
{
111119
return;
112120
}

0 commit comments

Comments
 (0)