From dd05a551244d98c6915bd769d9c86b490d3eb2b3 Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Sun, 15 Dec 2024 10:22:57 +0800 Subject: [PATCH] Fix #19369 - use `_getcwd` on windows --- compiler/src/dmd/backend/dwarfdbginf.d | 3 ++- compiler/src/dmd/json.d | 3 ++- compiler/src/dmd/root/filename.d | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/src/dmd/backend/dwarfdbginf.d b/compiler/src/dmd/backend/dwarfdbginf.d index a4ce1a37d9c2..ea87bbed6e8e 100644 --- a/compiler/src/dmd/backend/dwarfdbginf.d +++ b/compiler/src/dmd/backend/dwarfdbginf.d @@ -44,7 +44,8 @@ import dmd.backend.cdef; version(Windows) { nothrow - private extern (C) char* getcwd(char* buffer, size_t maxlen); + private extern (C) char* _getcwd(char* buffer, size_t maxlen); + alias getcwd = _getcwd; nothrow private extern (C) int* _errno(); // not the multi-threaded version } diff --git a/compiler/src/dmd/json.d b/compiler/src/dmd/json.d index 021387d6f438..174a2d95cd20 100644 --- a/compiler/src/dmd/json.d +++ b/compiler/src/dmd/json.d @@ -42,7 +42,8 @@ import dmd.target; import dmd.visitor; version(Windows) { - extern (C) char* getcwd(char* buffer, size_t maxlen); + extern (C) char* _getcwd(char* buffer, size_t maxlen); + alias getcwd = _getcwd; } else { import core.sys.posix.unistd : getcwd; } diff --git a/compiler/src/dmd/root/filename.d b/compiler/src/dmd/root/filename.d index a2f074dbfaec..cf00d8ad7f63 100644 --- a/compiler/src/dmd/root/filename.d +++ b/compiler/src/dmd/root/filename.d @@ -42,7 +42,8 @@ version (Windows) extern (Windows) DWORD GetFullPathNameW(LPCWSTR, DWORD, LPWSTR, LPWSTR*) nothrow @nogc; extern (Windows) void SetLastError(DWORD) nothrow @nogc; - extern (C) char* getcwd(char* buffer, size_t maxlen) nothrow; + extern (C) char* _getcwd(char* buffer, size_t maxlen) nothrow; + alias getcwd = _getcwd; } version (CRuntime_Glibc)