mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Platform: port to msvcrt, add msvcrt module
This adds the swiftMSVCRT module which is similar in spirit to swiftGlibc and swiftDarwin, exposing the Microsoft C Runtime library to swift. Furthermore, disable pieces of the standard library which are not immediately trivially portable to Windows. A lot of this functionality can still be implemented and exposed to the user, however, this is the quickest means to a PoC for native windows support. As a temporary solution, add a -DCYGWIN flag to indicate that we are building for the cygwin windows target. This allows us to continue supporting the cygwin environment whilst making the windows port work natively against the windows environment (msvc). Eventually, that will hopefully be replaced with an environment check in swift.
This commit is contained in:
@@ -17,6 +17,7 @@ import Darwin
|
||||
import Glibc
|
||||
#endif
|
||||
|
||||
#if !os(Windows) || CYGWIN
|
||||
public func _stdlib_mkstemps(_ template: inout String, _ suffixlen: CInt) -> CInt {
|
||||
#if os(Android)
|
||||
preconditionFailure("mkstemps doesn't work on Android")
|
||||
@@ -32,6 +33,7 @@ public func _stdlib_mkstemps(_ template: inout String, _ suffixlen: CInt) -> CIn
|
||||
return fd
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public var _stdlib_FD_SETSIZE: CInt {
|
||||
return 1024
|
||||
@@ -81,6 +83,7 @@ public struct _stdlib_fd_set {
|
||||
}
|
||||
}
|
||||
|
||||
#if !os(Windows) || CYGWIN
|
||||
public func _stdlib_select(
|
||||
_ readfds: inout _stdlib_fd_set, _ writefds: inout _stdlib_fd_set,
|
||||
_ errorfds: inout _stdlib_fd_set, _ timeout: UnsafeMutablePointer<timeval>?
|
||||
@@ -104,6 +107,7 @@ public func _stdlib_select(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Functions missing in `Darwin` module.
|
||||
|
||||
Reference in New Issue
Block a user