zlacker

[return to "Zig Libc"]
1. generi+PA1[view] [source] 2026-02-03 00:55:49
>>ingve+(OP)
This is very exciting for zig projects linking C libraries. Though I'm curious about the following case:

Let's say I'm building a C program targeting Windows with MinGW & only using Zig as a cross compiler. Is there a way to still statically link MinGW's libc implementation or does this mean that's going away and I can only statically link ziglibc even if it looks like MinGW from the outside?

◧◩
2. AndyKe+rC1[view] [source] 2026-02-03 01:04:37
>>generi+PA1
This use case is unchanged.

If you specify -target x86_64-windows-gnu -lc then some libc functions are provided by Zig, some are provided by vendored mingw-w64 C files, and you don't need mingw-w64 installed separately; Zig provides everything.

You can still pass --libc libc.txt to link against an externally provided libc, such as a separate mingw-w64 installation you have lying around, or even your own libc installation if you want to mess around with that.

Both situations unchanged.

◧◩◪
3. generi+4L1[view] [source] 2026-02-03 02:01:43
>>AndyKe+rC1
That's cool. I imagine I could also maintain a MinGW package that can be downloaded through the Zig package manager and statically linked without involving the zig libc? (Such that the user doesn't need to install anything but zig)

That's a good way to sell moving over to the zig build system, and eventually zig the language itself in some real-world scenarios imo.

[go to top]