diff --git a/build.cmd b/build.cmd index d72b240..578afa9 100644 --- a/build.cmd +++ b/build.cmd @@ -15,7 +15,7 @@ if "%1" == "debug" ( set CL=/MT /Od /Zi /RTC1 /Fdprogmgr.pdb /fsanitize=address /DUNICODE /DPROGMGR_GIT_HASH="%GIT_HASH%" set LINK=/DEBUG ) else ( - set CL=/O1 /GS- /DUNICODE /DNDEBUG /DPROGMGR_NO_CRT /DPROGMGR_GIT_HASH="%GIT_HASH%" + set CL=/O1 /GS- /DUNICODE /DNDEBUG /DPROGMGR_GIT_HASH="%GIT_HASH%" set LINK=/NODEFAULTLIB /OPT:REF /OPT:ICF ) diff --git a/progmgr/progmgr.c b/progmgr/progmgr.c index 705fac9..3eacc33 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -166,7 +166,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, return 0; } -#ifdef PROGMGR_NO_CRT +// NOTE(u130b8): We're compiling without the C runtime by default in Release builds. +// But in Debug builds, we need the C runtime, otherwise the address sanitizer and +// MSVC debug tools break because they use the wWinMainCRTStartup entrypoint to initialize. + +#ifdef NDEBUG #pragma function(memset) void *memset(char* dst, int value, size_t count) { while (count--) { *dst++ = value; }