Skip to content

Commit d30bccd

Browse files
committed
fix(compat): include stdlib.h so getenv/_putenv_s compile on native ARM64 Windows
compat.h calls getenv (cbm_tmpdir) and _putenv_s (cbm_setenv/cbm_unsetenv) but only included stddef.h and stdio.h. The x86-64 mingw toolchain pulled stdlib.h in transitively, so it built there, but the aarch64 (CLANGARM64) include chain does not — the calls became implicit declarations that conflict with the real stdlib.h getenv type and fail to compile on native ARM64 Windows. Include stdlib.h directly so the declarations are correct on every toolchain. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 8276afc commit d30bccd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/foundation/compat.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
#include <stddef.h>
1212
#include <stdio.h>
13+
/* stdlib.h declares getenv (cbm_tmpdir) and, on Windows, _putenv_s (cbm_setenv/
14+
* cbm_unsetenv). The x86-64 mingw toolchain pulled it in transitively, but the
15+
* aarch64 (CLANGARM64) include chain does not, so include it directly — without
16+
* it those calls become implicit declarations that conflict with the real
17+
* stdlib.h types and fail to compile on native ARM64 Windows. */
18+
#include <stdlib.h>
1319

1420
/* ── Thread-local storage ─────────────────────────────────────── */
1521
/* _Thread_local is C11 standard — works on GCC, Clang, and MSVC (2019+).

0 commit comments

Comments
 (0)