A segmentation fault on minGW

liao shuisheng shuisheng.liao at gmail.com
Sat Dec 1 17:15:14 CET 2012


I'm beginner on libev, I can compile libev-4.11 in minGW, and I write some
code like this:

 #include <ev.h>
#include <stdio.h> // for puts
ev_io stdin_watcher;
ev_timer timeout_watcher;
static void stdin_cb (EV_P_ ev_io *w, int revents)
puts ("stdin ready");
ev_io_stop (EV_A_ w);
ev_break (EV_A_ EVBREAK_ALL);

static void timeout_cb (EV_P_ ev_timer *w, int revents)
puts ("timeout");
ev_break (EV_A_ EVBREAK_ONE);

int main (void)
struct ev_loop *loop = EV_DEFAULT;
ev_io_init (&stdin_watcher, stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
ev_io_start (loop, &stdin_watcher);
ev_timer_init (&timeout_watcher, timeout_cb, 5.5, 0.);
ev_timer_start (loop, &timeout_watcher);
ev_run (loop, 0);
return 0;

I can compile it successfully, when run it, report segmentation fault. The
GDB debug info below:
$ gdb main.exe
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
Reading symbols from G:\MinGW\msys\1.0\home\shuisheng\main.exe...done.
(gdb) r
Starting program: G:\MinGW\msys\1.0\home\shuisheng\main.exe
[New Thread 6324.0x704]

Program received signal SIGSEGV, Segmentation fault.
ev_start (active=1, w=0x40c020, loop=0x0) at ev.c:3209
3209      ev_ref (EV_A);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x772015ee in ntdll!LdrQueryProcessModuleInformation ()
   from C:\Windows\system32\ntdll.dll
 anybody can help me? thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20121202/3cc728d4/attachment.html>

More information about the libev mailing list