Skip to content

Commit 44e1e4c

Browse files
authored
Merge pull request #2026 from compnerd/prepare-to-be-networked
Foundation: initialize CFSocket on startup
2 parents a0dd497 + d6f351f commit 44e1e4c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ _stat_with_btime(const char *filename, struct stat *buffer, struct timespec *bti
566566
#warning "Enabling statx"
567567
#endif
568568

569+
#if DEPLOYMENT_TARGET_WINDOWS
570+
CF_EXPORT void __CFSocketInitializeWinSock(void);
571+
#endif
572+
569573
_CF_EXPORT_SCOPE_END
570574

571575
#endif /* __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ */

Foundation/NSSwiftRuntime.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ internal func __CFSwiftGetBaseClass() -> UnsafeRawPointer {
150150
@usableFromInline
151151
@_cdecl("__CFInitializeSwift")
152152
internal func __CFInitializeSwift() {
153-
153+
#if os(Windows)
154+
__CFInitializeWinSock()
155+
#endif
156+
154157
_CFRuntimeBridgeTypeToClass(CFStringGetTypeID(), unsafeBitCast(_NSCFString.self, to: UnsafeRawPointer.self))
155158
_CFRuntimeBridgeTypeToClass(CFArrayGetTypeID(), unsafeBitCast(_NSCFArray.self, to: UnsafeRawPointer.self))
156159
_CFRuntimeBridgeTypeToClass(CFDictionaryGetTypeID(), unsafeBitCast(_NSCFDictionary.self, to: UnsafeRawPointer.self))

0 commit comments

Comments
 (0)