[D-runtime] druntime fixes again break Windows DLL support

Rainer Schuetze r.sagitario at gmx.de
Wed Apr 20 22:38:24 PDT 2011


Sean Kelly wrote:
> Is there a problem with sockets as well?
> 

I remember problems with WSACleanup being called from the static 
destructor in std.socket. This killed all connections when a thread 
terminated. But this was a bug and was fixed by using the shared static 
destructor.

Rereading the MSDN documentation for WSAStartup and WSACleanup, it seems 
save to have a pair of these calls in each DLL. But this statement

"The WSAStartup function typically leads to protocol-specific helper 
DLLs being loaded. As a result, the WSAStartup function should not be 
called from the DllMain function in a application DLL. This can 
potentially cause deadlocks."

suggests it would be better to have a lazy init call to WSAStartup when 
first using sockets.


More information about the D-runtime mailing list