[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (x)gethostname
From: |
Bruno Haible |
Subject: |
Re: (x)gethostname |
Date: |
Fri, 18 Jan 2008 11:54:53 +0100 |
User-agent: |
KMail/1.5.4 |
Hi Simon,
> > But this is still not complete: The doc/functions/gethostname.texi file
> > says that the problem is that mingw lacks a gethostname function.
>
> This is not the case now, and I'm not sure it ever was. Where did that
> information come from?
I wrote it: I saw that the .m4 macro only looked whether the function was
missing and, based on the results of "nm" on various systems' libraries,
found that mingw was such a system. Evidently I didn't consider ws2_32 as
a system library.
> For reference, the Windows documentation for gethostname is:
>
> http://msdn2.microsoft.com/en-us/library/ms738527.aspx
Thanks for the reference. So, to accomodate this function, we need a
rpl_gethostname that calls gethostname and accomodates
1. for the need to call WSAStartup() before,
This will require a new module 'sockets' in gnulib, because obviously
we don't want to call WSAStartup() more than once.
2. for the conversion from a WSA* error code to an <errno.h> error code.
This will require, in particular, an 'errno' module and a modification
to the 'strerror' module.
> The MSDN documentation says it is in winsock2.h and ws2_32, so I think
> we should use those headers/libraries until we know a reason to prefer
> winsock.h and wsock32.
Yes, I agree. Your sys_socket module already uses winsock2; there is no
point in mixing two different implementations of socket libraries.
> > And it is necessary to still override the function, in order to
> > WSAStartup before?
>
> No, this doesn't seem to be necessary, at least under Wine.
I don't think that you can judge the behaviour of Windows by testing on
Wine. You know that Wine reimplements every DLL, so in particular Wine's
winsock is a different implementation that Windows winsock.
Bruno
- (x)gethostname, Simon Josefsson, 2008/01/16
- Re: (x)gethostname, Eric Blake, 2008/01/16
- Re: (x)gethostname, Bruno Haible, 2008/01/16
- Re: (x)gethostname, Simon Josefsson, 2008/01/17
- Re: (x)gethostname, Simon Josefsson, 2008/01/24
- Re: (x)gethostname, Simon Josefsson, 2008/01/24
- Re: (x)gethostname, Brian Dessent, 2008/01/24
- Re: (x)gethostname, Simon Josefsson, 2008/01/24
Re: (x)gethostname, Simon Josefsson, 2008/01/17