Windows Compilation problem

Matt Tolton matt at tolton.com
Thu Jun 5 05:18:09 CEST 2008


Hi,

I've debugged this a little bit further, and have more information to
give.  In poking around on the net and in the libev code, I couldn't
determine why it was necessary to use _get_osfhandle().  I tried the
following experiment, and changed my ev_cpp.cpp to look like this:

#include <io.h>
#define EV_FD_TO_WIN32_HANDLE(fh) fh
#include "ev_cpp.h"
#include <ev/ev.c>

This allowed things to work until a socket was closed and fd_ebadf
(and hence fd_valid) was called, causing another call to
_get_osfhandle().  FYI, the place that that function is crashing is at
the following assertion:

       _VALIDATE_CLEAR_OSSERR_RETURN((_osfile(fh) & FOPEN), EBADF, -1);

Might I ask...what is the _get_osfhandle() call for?  It seems like it
is ok to just use the handle returned by socket() in my case.

Thanks,

Matt



More information about the libev mailing list