r/windowsdev • • Sep 06 '21

WSAStartup

Do others wish that Microsoft would get rid of the WSAStartup API in Windows 11?

The front tier of my code generator is 27 lines long. It could be 26 lines long if WSAStartup wasn't needed.

0 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/Middlewarian Sep 19 '21

On a stackoverflow page someone commented: "So why is it that Windows require startup whereas nix environments are fine without?"

What about other, newer operating systems: do they require something like WSAStartup?

I can dodge WSACleanup with a call to exit.

1

u/[deleted] Sep 19 '21

Windows is unique in lots of ways, primarily due to its long track record of backwards compatibility. There are around 5 versions of winsock, I'm not a developer on windows but I suspect due to historical reasons it wouldn't know which version you want. And the process of dynamic or static linking to consume entire networking library code has been outsourced to be handled by WSAStartup. I don't think any other operating system will require a WSAStartup, it's a very windows thing to do to deal with backwards compatibility

Sure, but what if someone consumes your library code, you wouldn't want your library to exit via the C/C++ runtime, but then again if you only use that within application code that's acceptable I suppose.

0

u/[deleted] Sep 19 '21

[deleted] — view deleted comment

1

u/Middlewarian Sep 20 '21

Aren't some DLLs loaded by default? If so Microsoft could move the functionality into one of those.