bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: winsock: needs access to SOCKET in application code


From: Simon Josefsson
Subject: Re: winsock: needs access to SOCKET in application code
Date: Thu, 16 Oct 2008 09:06:32 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Hi Simon,
>
>> > The return type should be SOCKET, which is either `unsigned int' or
>> > 'unsigned long' (don't know about win64).
>> 
>> How would that work on non-Mingw systems?  The idea should be that gsasl
>> calls the function unconditionally, in order to work around limitations
>> of the gnulib winsock wrappers.
>
> Hmm, I thought the function would be defined only on native Win32 systems,
> since its return type 'SOCKET' does not exist on Unix, and we don't want
> Win32 types to be used in code meant to compile on Unix. (Emulate POSIX
> on Win32, not vice versa.)

That approach leads to ugly code in gsasl:

#if ?
      gnutls_transport_set_ptr (session, (gnutls_transport_ptr)
                                gl_fd_to_socket (sockfd));
#else
      gnutls_transport_set_ptr (session, (gnutls_transport_ptr) sockfd);
#endif

It would be simpler to write:

   /* Need to call gl_fd_to_socket to get a proper socket out of
      gnulib's Winsock POSIX emulation.  It is a no-op on other
      systems. */
  gnutls_transport_set_ptr (session, (gnutls_transport_ptr)
                            gl_fd_to_socket (sockfd));

I'm not sure either though.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]