Skip to content

Commit 18617a3

Browse files
committed
Fix ambiguous use of overloaded symbols
Some constants are exported by CoreFoundation, but they has mismatched type with WinSDK overlay. Set them explicitly.
1 parent 4fa549b commit 18617a3

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Sources/Foundation/FileHandle.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ fileprivate let _close = Glibc.close(_:)
2525
#endif
2626

2727
#if canImport(WinSDK)
28-
// We used to get the copy that was re-exported by CoreFoundation
28+
// We used to get the alias that was re-exported by CoreFoundation
2929
// but we want to explicitly depend on its types in this file,
3030
// so we need to make sure Swift doesn't think it's @_implementationOnly.
31-
import WinSDK
31+
import struct WinSDK.HANDLE
3232
#endif
3333

3434
extension NSError {

Sources/Foundation/Process.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import Darwin
1414
#endif
1515

1616
#if canImport(WinSDK)
17-
// We used to get the copy that was re-exported by CoreFoundation
17+
// We used to get the alias that was re-exported by CoreFoundation
1818
// but we want to explicitly depend on its types in this file,
1919
// so we need to make sure Swift doesn't think it's @_implementationOnly.
20-
import WinSDK
20+
import struct WinSDK.HANDLE
2121
#endif
2222

2323
extension Process {
@@ -1162,6 +1162,13 @@ open class Process: NSObject {
11621162
}
11631163

11641164
extension Process {
1165-
11661165
public static let didTerminateNotification = NSNotification.Name(rawValue: "NSTaskDidTerminateNotification")
11671166
}
1167+
1168+
#if os(Windows)
1169+
// FIXME: This is a workaround for CoreFoundation/WinSDK overload
1170+
// of the same constants with different types. We should prevent
1171+
// CoreFoundation from re-exporting them.
1172+
fileprivate let HANDLE_FLAG_INHERIT = DWORD(0x00000001)
1173+
fileprivate let STARTF_USESTDHANDLES = DWORD(0x00000100)
1174+
#endif

0 commit comments

Comments
 (0)