Hi,
i'm using libevent 1.4.9 with mingw under windows had have trouble setting up a minimal web server. ---( code )--- #include <stdio.h> #include <evhttp.h> #define sleep(seconds) Sleep(seconds * 1000) int main(int argc, char** argv) { #ifdef WIN32 WSADATA wsaData; if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) { fprintf(stderr, "WSAStartup failed.\n"); return 1; } #endif struct evhttp* server = evhttp_new(0); if (!server) { exit(1); } int rc = evhttp_bind_socket(server, "127.0.0.1", 30080); if (rc) { exit(1); } sleep(120); /* Unter Windows WinSock wieder freigeben */ #ifdef MINGW WSACleanup(); #endif return 0; } --- No it seams that the program crashes while calling evhttp_bind_socket ---( GDB )--- GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"... (gdb) run Starting program: tmp/cac.exe Loaded symbols for C:\WINDOWS\system32\ntdll.dll Loaded symbols for C:\WINDOWS\system32\kernel32.dll Loaded symbols for C:\WINDOWS\system32\msvcrt.dll Loaded symbols for C:\WINDOWS\system32\ws2_32.dll Loaded symbols for C:\WINDOWS\system32\ws2help.dll Loaded symbols for C:\WINDOWS\system32\advapi32.dll Loaded symbols for C:\WINDOWS\system32\rpcrt4.dll Loaded symbols for C:\WINDOWS\system32\secur32.dll Loaded symbols for tmp\libevent.dll Program received signal SIGSEGV, Segmentation fault. 0x62e03618 in event_add (ev=0x3d4088, tv=0x0) at tmp/libevent/event.c:717 717 const struct eventop *evsel = base->evsel; (gdb) backtrace #0 0x62e03618 in event_add (ev=0x3d4088, tv=0x0) at tmp/libevent/event.c:717 #1 0x62e0a1fc in evhttp_accept_socket (http=0x3d2588, fd=1896) at tmp/libevent/http.c:2248 #2 0x62e0a14a in evhttp_bind_socket (http=0x3d2588, address=0x403086 "0.0.0.0", port=30080) at tmp/libevent/http.c:2222 #3 0x004014fc in main (argc=1, argv=0x3d2568) at tmp/src/main.c:72 --- I have no idea what happens, perhaps forgot to call some initialization function. Can somebody help? _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users