Re: a segmentation fault on minGW

2012-12-05 Thread Zsbán Ambrus
On 12/5/12, Marc Lehmann  wrote:
> Your code is badly misformatted, so I mightoverlook some detail, but it
> looks ok.

It's supposed to look ok, because it's the example program from the
SYNOPSIS section of the libev manual, only it's reformatted and most
comments are removed.

Ambrus

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev


Re: a segmentation fault on minGW

2012-12-05 Thread Marc Lehmann
On Sat, Dec 01, 2012 at 11:57:30PM +0800, ss_liao  wrote:
> I'm beginner on libev, I can compile libev-4.11 in minGW, and I write some 
> code like this:

Your code is badly misformatted, so I mightoverlook some detail, but it looks
ok.

> ev_io_start (loop, &stdin_watcher);
> ev_timer_start (loop, &timeout_watcher);

it probably crashes on either of these lines, and if yourdebugging output is
correct (it might not be) then it's because loop is 0.

I am afraid you have to debug this yourself - however, did you compile
libev using the same compiler and flags as your program, and are you sure you
are linking to the right libev?

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev


A segmentation fault on minGW

2012-12-01 Thread liao shuisheng
Hi,

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

 #include 
#include  // 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 
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
(gdb)
==
 anybody can help me? thanks!
___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev