Static initialization order is implementation specific.

This commit is contained in:
Bartosz Taudul 2017-09-18 18:55:25 +02:00
parent 9d2fef2f11
commit 4ce7f77cd9

View File

@ -30,12 +30,22 @@ struct __wsinit
exit( 1 );
}
}
} ___wsinit;
};
static __wsinit InitWinSock()
{
static __wsinit init;
return init;
}
#endif
Socket::Socket()
: m_sock( -1 )
{
#ifdef _MSC_VER
InitWinSock();
#endif
}
Socket::Socket( int sock )
@ -182,6 +192,9 @@ bool Socket::HasData()
ListenSocket::ListenSocket()
: m_sock( -1 )
{
#ifdef _MSC_VER
InitWinSock();
#endif
}
ListenSocket::~ListenSocket()