windows: address review feedback on DLL CRT init PR

Use b.allocator instead of b.graph.arena for SDK detection and
path formatting -- b.allocator is the public API, b.graph.arena
is an internal field.

Move test_dll_init.c from windows/Ghostty.Tests/ to test/windows/
with a README. Test infrastructure belongs under test/, not the
Windows app directory.
This commit is contained in:
Alessandro De Blasis
2026-03-27 04:18:16 +01:00
committed by Mitchell Hashimoto
parent 656700d803
commit 5d92222621
3 changed files with 30 additions and 2 deletions

View File

@@ -109,7 +109,7 @@ pub fn initShared(
// ucrt.lib is in the Windows SDK 'ucrt' dir. Detect the SDK
// installation and add the UCRT library path.
const arch = deps.config.target.result.cpu.arch;
const sdk = std.zig.WindowsSdk.find(b.graph.arena, arch) catch null;
const sdk = std.zig.WindowsSdk.find(b.allocator, arch) catch null;
if (sdk) |s| {
if (s.windows10sdk) |w10| {
const arch_str: []const u8 = switch (arch) {
@@ -119,7 +119,7 @@ pub fn initShared(
else => "x64",
};
const ucrt_lib_path = std.fmt.allocPrint(
b.graph.arena,
b.allocator,
"{s}\\Lib\\{s}\\ucrt\\{s}",
.{ w10.path, w10.version, arch_str },
) catch null;

28
test/windows/README.md Normal file
View File

@@ -0,0 +1,28 @@
# Windows Tests
Manual test programs for Windows-specific functionality.
## test_dll_init.c
Regression test for the DLL CRT initialization fix. Loads ghostty.dll
at runtime and calls ghostty_info + ghostty_init to verify the MSVC C
runtime is properly initialized.
### Build
```
zig cc test_dll_init.c -o test_dll_init.exe -target native-native-msvc
```
### Run
```
copy ..\..\zig-out\lib\ghostty.dll . && test_dll_init.exe
```
Expected output (after the CRT fix):
```
ghostty_info: <version string>
ghostty_init: 0
```