On Thu, Nov 08, 2007 at 09:45:14PM +0100, Marc Lehmann wrote: [...] > > - I got some GCC warnings when building ev.c; I've attached them. > > I have removed -Wall from the default cflags for gcc, they should be gone > by now.
Would it be possible to fix the warnings instead of disabling them?
Compiler warnings can catch a lot of problems in C code, and disabling
them makes me nervous. I can try to write a patch some time, if you
like.
> > - It looks like the way that fd_event() handles FD events uses an array,
> > anfd, to map fd values to ev_io values. This won't work very will
> > on windows, where sockets aren't 0-indexed and aren't necessarily
> > sequential. Any thoughts on how to get win32.c working?
>
> win32.c is only accidentally included. libev uses its select backend and
> file descriptors on windows too. This is an incompatibility I will not
> address, as I think libev should use fds on all architectures (and the
> typical way I see sockets being used for portable programs is using fds).
Ah, I think we have a misunderstanding. The "sockets" I'm talking
about are kind of fd-like; they're not win32 handles. In other words,
with the current libevent, the following code works on win32 and on
Unix:
int s = (int) socket(AF_INET, SOCK_STREAM, 0);
struct event *ev = malloc(sizeof(struct event));
struct sockaddr_in saddr = { .... };
connect(s, (struct sockaddr*)&saddr, sizeof(saddr));
/* make s nonblocking ... */
event_set(ev, s, EV_READ|EV_WRITE, cb, NULL);
event_add(ev);
On unix, "s" is an fd. On win32, it's a socket. The only differences
is: windows sockets don't start at 0, they aren't consecutive, you
can't use fds with the windows networking code, and you can't use
sockets with the file code.
It's kind of a mess, actually. Unfortunately, if you want to do
portable network programming on win32, it's about the best you can do.
> This is a wanted incompatibility (as it makes windows and unix compatible,
> the fatc that I had to use os handles and not fds actually was one of the
> problems I encountered with libevent).
Right; I'm not proposing that libev should accept Windows HANDLEs
right now -- libevent sure doesn't.
[...]
> > - I needed to include "-lm" and "-lrt" in my libraries to build.
> > This isn't a bug, but it's something other people should know if
> > they want to try this too.
>
> Hmm, how does libevent handle that (I use the same confgiure etc. stuff as
> libevent, and libevent also requires extra libraries such as -lrt).
Through libtool, automake, and autoconf, I thought. I'm not really
sure what went wrong here. :( I'll try to poke at it more next chance
I get.
thanks again,
--
Nick Mathewson
pgpf5zAXFE2KV.pgp
Description: PGP signature
_______________________________________________ Libevent-users mailing list [email protected] http://monkeymail.org/mailman/listinfo/libevent-users
