Bruno Haible <[EMAIL PROTECTED]> writes: > Simon wrote: >> Is there any way for gnulib to detect that a fd was created by gnulib's >> winsock wrappers or the native systems? > > Actually these two are different types: gnulib's file descriptors are 'int' > in the small nonnegative range, whereas a SOCKET is actually a HANDLE that > can be passed to ReadFile and WriteFile. > >> >>> More or less. Actually, the flag could be just "use send/recv or >> >>> read/write?" because of what I said above, and that means that it could >> >>> be done without including lib/winsock.c or other similarly unwanted >> >>> baggage into gnutls. >> >> >> >> Are you saying that read/write on the socket would work under Windows? > > Here's a matrix: > > | native fd | gnulib | native SOCKET | > | | wrapped fd | | > ----------------------------------------------------------------------- > ReadFile, WriteFile | | | YES | > ----------------------------------------------------------------------- > MSVCRT recv, send | | | YES | > ----------------------------------------------------------------------- > MSVCRT read, write | YES | YES | | > -----------------------------------------------------------------------
Thanks. Is there a place in the gnulib manual to add this? I searched for your _WIN32/CYGWIN/etc CPP macro matrix yesterday, and having that in the gnulib manual as well would have saved me time. Assuming you and others feel it is appropriate, of course. >> Then the GnuTLS ABI doesn't depend on how gnulib have implemented sockets >> under Windows. > > There was only really one boolean choice in how gnulib supports sockets: > either as SOCKET (in the past) or as 'int' (like on Unix, now). But the internal gnulib implementation might change, right? I mean, the FD_TO_SOCKET macro is an implementation detail in gnulib, but if that ever changes, it would break binary compatibility if GnuTLS exposes the SOCKET vs int difference. Maybe I misunderstood though. /Simon