win64-native-builds
Installation
SKILL.md
Win64 Native Builds
Playbook for native Windows executables built from source with shell tools.
Compiler selection (the fork in the road)
- App ships its own Win32 header (e.g.
win32_min.hdeclaring prototypes, no libc includes): Clang works WITHOUT the Windows SDK. This is what makes a strict-Werrorrelease build possible on a machine with no MSVC installed. Clang lives atC:/Program Files/LLVM/bin/clang.exe. - Anything including libc headers (
<stdio.h>,<string.h>— i.e. almost every test): use mingwgccfrom PATH. Clang in default MSVC mode lacks libc/UCRT headers until the full Windows SDK is installed; don't fight it, tests don't need clang. - Tests may
#include "main.c"directly to see every static — no header extraction needed. Give test mains a dummyWinMainCRTStartupdefine if the app defines WinMain.
Flags that are load-bearing
| Flag | Reason |
|---|---|
-fno-builtin on test/gcc builds |
Compiler turns a hand-written memset/memcpy into a call to itself → infinite recursion. Silent until stack overflow. |
-l<lib> AFTER source files |
GNU ld resolves left-to-right; libs first = unresolved symbols. |
-Wl,--stack,8388608 |
Default 1 MB stack dies on large static arrays in tests. |
-O2 -w for the suite |
Strictness belongs to the app's -Werror build; the suite optimizes for speed and signal. |
Suite runner pattern
One committed run_all_tests.sh: cd to script dir, pick first available compiler (gcc→cc→clang), fixed flags, compile every *_test.c, run each, print PASS/FAIL name and a final count. Delete the output dir's old files first so stale passes can't mask failures. Per-test convention: a reset_all() helper between checks; assert-style checks that print FAIL: and set nonzero exit.