Windows Compilation problem

Matt Tolton matt at tolton.com
Thu Jun 5 01:29:46 CEST 2008


Hi,

Thanks for the assistance.

I grabbed the current version from CVS and that seemed to fix the
compilation issues, so long as I included io.h manually.  However, now
when I run the program, it is crashing on line 16 of ev.c, in the
fd_reify function when it calls _get_osfhandle().

Any pointers here?  The fd that I'm using is a socket obtained from
the winsock socket() call.  Here is the code used to initialize it:

void initServerSocket() {
    int res;
    int serverfd = socket(AF_INET, SOCK_STREAM, 0);

    if (serverfd == -1)
        THROW("socket() failed");

    if (!SetSocketNonBlocking(serverfd))
        THROW("error setting socket nonblocking");

    sockaddr server_addr;

    init_sockaddr("0.0.0.0", 5111, &server_addr);

    res = bind(serverfd, &server_addr, sizeof(server_addr));

    if (res == -1)
        THROW("bind() failed");

    res = listen(serverfd, 10);

    if (res == -1)
        THROW("listen() failed");

    ev::io * server_watcher = new ev::io;
    server_watcher->set<serverSocketCb>(0);
    server_watcher->set(serverfd, EV_READ);
    server_watcher->start();

    LOGI << "Server socket initialized.";
}

Thanks,

Matt



More information about the libev mailing list