# compiler: Don't link ucrtbased.dll when targeting \*\-windows-msvc in Debug mode\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/cd03a0a153aae3e0450b7878b67906fb41521d13)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: cd03a0a153aae3e0450b7878b67906fb41521d13

Requested commit: cd03a0a153aae3e0450b7878b67906fb41521d13

Commit: cd03a0a153aae3e0450b7878b67906fb41521d13

Tree: 81aabde76e990bc4e26f9aa3df0db6a8a983f424

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
compiler: Don't link ucrtbased.dll when targeting *-windows-msvc in Debug mode.

Linking it by default means that we produce binaries that, effectively, only run
on systems which have the Windows SDK installed because ucrtbased.dll is not
redistributable, and the Windows SDK is what actually installs ucrtbased.dll
into %SYSTEM32%. The resulting binaries also can't run under Wine because Wine
does not provide ucrtbased.dll.

It is also inconsistent with our behavior for *-windows-gnu where we always link
ucrtbase.dll. See #23983, #24019, and #24053 for more details.

So just use ucrtbase.dll regardless of mode. With this change, we can also drop
the implicit definition of the _DEBUG macro in zig cc, which has in some cases
been problematic for users.

Users who want to opt into the old behavior can do so, both for *-windows-msvc
and *-windows-gnu, by explicitly passing -lucrtbased and -D_DEBUG. We might
consider adding a more ergonomic flag like -fdebug-crt to the zig build-* family
of commands in the future.

Closes #24052.

```

## Parents

- [826e1c30ba81884e1a8fad8664b3da17953d89d1](https://git.cafe/gitcafe/zig/commit/826e1c30ba81884e1a8fad8664b3da17953d89d1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/cd03a0a153aae3e0450b7878b67906fb41521d13?format=markdown)
