aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/luaevent.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/luaevent.c b/src/luaevent.c
index b356c92..c9b5430 100644
--- a/src/luaevent.c
+++ b/src/luaevent.c
@@ -12,6 +12,10 @@
#define EVENT_BASE_MT "EVENT_BASE_MT"
+#ifdef _WIN32
+#include <winsock2.h>
+#endif
+
le_base* event_base_get(lua_State* L, int idx) {
return (le_base*)luaL_checkudata(L, idx, EVENT_BASE_MT);
}
@@ -127,6 +131,12 @@ void setNamedIntegers(lua_State* L, namedInteger* p) {
/* Verified ok */
int luaopen_luaevent_core(lua_State* L) {
+#ifdef _WIN32
+ WORD wVersionRequested = MAKEWORD(2, 2);
+ WSADATA wsaData;
+ WSAStartup(wVersionRequested, &wsaData);
+#endif
+ event_init( );
/* Register external items */
event_callback_register(L);
event_buffer_register(L);
@@ -145,3 +155,4 @@ int luaopen_luaevent_core(lua_State* L) {
setNamedIntegers(L, consts);
return 1;
}
+