# mingw: Rename mingw32.lib to libmingw32.lib\. · gitcafe/zig

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

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

Visibility: public

Requested revision: fbdf64a7dac93dfcb5aa0240477689c174906695

Requested commit: fbdf64a7dac93dfcb5aa0240477689c174906695

Commit: fbdf64a7dac93dfcb5aa0240477689c174906695

Tree: 4daf77b02f49fc107c473d110aedbfb1ffe77da9

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
mingw: Rename mingw32.lib to libmingw32.lib.

LLD expects the library file name (minus extension) to be exactly libmingw32. By
calling it mingw32 previously, we prevented it from being detected as being in
LLD's list of libraries that are excluded from the MinGW-specific auto-export
mechanism.

https://github.com/llvm/llvm-project/blob/b9d27ac252265839354fffeacaa8f39377ed7424/lld/COFF/MinGW.cpp#L30-L56

As a result, a DLL built for *-windows-gnu with Zig would export a bunch of
internal MinGW symbols. This sometimes worked out fine, but it could break at
link or run time when linking an EXE with a DLL, where both are targeting
*-windows-gnu and thus linking separate copies of mingw32.lib. In #23204, this
manifested as the linker getting confused about _gnu_exception_handler() because
it was incorrectly exported by the DLL while also being defined in the
mingw32.lib that was being linked into the EXE.

Closes #23204.

```

## Parents

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

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