win32: initialize Windows Sockets in NSObject only

And update to Windows Socket version 2.2. Also clean up the DllMain initialization to handle CRT init errors and call _CRT_INIT also on DLL/thread detach, and remove uneeded .idata section after removing WSAStartup() import.

WSAStartup() should not be called from DllMain according to MS documentation. Fixes #186.
This commit is contained in:
Frederik Seiffert 2021-08-10 17:53:37 +02:00 committed by Frederik Seiffert
parent b2f2a3a429
commit f67c99dbcc
5 changed files with 26 additions and 82 deletions

View file

@ -541,13 +541,6 @@ static Class runLoopClass;
{
tlsLock = [NSLock new];
[[NSObject leakAt: &tlsLock] release];
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData);
#endif
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableData class];
portMessageClass = [NSPortMessage class];