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

@ -987,21 +987,6 @@ int main(int argc, char *argv[], char *env[])
sizeof(_NSConstantStringClassReference));
#endif
#if defined(_WIN32)
WSADATA lpWSAData;
// Initialize Windows Sockets
if (WSAStartup(MAKEWORD(1,1), &lpWSAData))
{
printf("Could not startup Windows Sockets\n");
exit(1);
}
#endif /* _WIN32 */
#ifdef __MS_WIN__
_MB_init_runtime();
#endif /* __MS_WIN__ */
_gnu_process_args(argc, argv, env);
/* Call the user defined main function */