summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-26 19:13:51 -0400
committerAdam <Adam@anope.org>2011-05-16 04:08:47 -0400
commite7887c1f013248274574ab8e3167f742ccb3d69b (patch)
treef9f5959512b7129711f03156320ae0e46cabaec3 /src/win32
parent076ebafa1b4cc935c466c615b94eaac415af9a67 (diff)
Unmodularized the socket engine because its causing problems and really is unnecessary
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/anope_windows.h2
-rw-r--r--src/win32/windows.cpp13
2 files changed, 15 insertions, 0 deletions
diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h
index 97ad76080..6d16e5554 100644
--- a/src/win32/anope_windows.h
+++ b/src/win32/anope_windows.h
@@ -42,6 +42,8 @@
/* VS2008 hates having this define before its own */
#define vsnprintf _vsnprintf
+extern CoreExport void OnStartup();
+extern CoreExport void OnShutdown();
extern CoreExport USHORT WindowsGetLanguage(const char *lang);
extern CoreExport int inet_pton(int af, const char *src, void *dst);
extern CoreExport const char *inet_ntop(int af, const void *src, char *dst, size_t size);
diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp
index 3876c62bf..265b5601b 100644
--- a/src/win32/windows.cpp
+++ b/src/win32/windows.cpp
@@ -34,6 +34,19 @@ WindowsLanguage WindowsLanguages[] = {
{NULL, 0}
};
+WSADATA SocketEngine::wsa;
+
+void OnStartup()
+{
+ if (WSAStartup(MAKEWORD(2, 0), &wsa))
+ throw FatalException("Failed to initialize WinSock library");
+}
+
+void OnShutdown()
+{
+ WSACleanup();
+}
+
USHORT WindowsGetLanguage(const char *lang)
{
for (int i = 0; WindowsLanguages[i].languageName; ++i)