Commit Graph
3 Commits
Author SHA1 Message Date
Fabian Fett 5679824930 [Windows] Ensure WSAStartup is correctly called. (#3366)
### Motivation

- `WSAStartup` isn't called

### Changes

- Change stuff that I have very little idea about until it works

### Result

WSAStartup is now emitted at the correct location for the linker to be
picked up.
2025-09-03 16:16:21 +00:00
Saleem Abdulrasool c141d91338 CNIOWindows: preprocess away WinSock support code (#1639)
This preprocesses away the WinSock2 support code when on non-Windows
targets.
2020-09-21 17:23:03 +01:00
Saleem AbdulrasoolandCory Benfield ad419b56d4 NIO: add module constructor for Windows (#1450)
This adds the necessary code to add a module constructor for NIO.  On
Windows, the socketing subsystem (WinSock) must be explicitly
initialized unlike Unices.  Add a module constructor that will be
handled by the C runtime to initialize the subsystem before the module
code is executed so that the user does not need to worry about this.

Since there is no way to inject this in Swift, write a tiny helper in C
and link that into the final NIO binary.

Since swift-package-manager does not support mixed-language directories,
add this to `CNIOWindows` which will need to be statically linked and
must always be imported as `@_implementationOnly` as this cannot be
linked into any user libraries.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-03-21 17:51:16 +00:00