Skip to content

Commit 64a89bf

Browse files
Merge pull request #4894 from kateinoigakukun/pr-98833f56713b558c0c12e861fc32e466dd3dfd5c
[wasm] Fix definition conflict of `errno`
2 parents 44ee4ed + a5d3c21 commit 64a89bf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Foundation/NSPathUtilities.swift

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
@_implementationOnly import CoreFoundation
1111
#if os(Windows)
1212
import WinSDK
13+
#elseif os(WASI)
14+
import WASILibc
15+
// CoreFoundation brings <errno.h> but it conflicts with WASILibc.errno
16+
// definition, so we need to explicitly select the one from WASILibc.
17+
// This is defined as "internal" since this workaround also used in other files.
18+
internal var errno: Int32 {
19+
get { WASILibc.errno }
20+
set { WASILibc.errno = newValue }
21+
}
1322
#endif
1423

1524
#if os(Windows)

0 commit comments

Comments
 (0)