[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] Re: windows build needs gethostname ?
From: |
Derek Robert Price |
Subject: |
[bug-gnulib] Re: windows build needs gethostname ? |
Date: |
Tue, 30 Nov 2004 14:08:18 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The prototype that our Windows developer is using as a workaround is:
int __stdcall gethostname (char * name, int namelen);
Don't know why the "int gethostname (char * name, int namelen);" decl
wouldn't work.
Mark D. Baushke wrote:
> Greetings,
>
> Using GNULIB xgethostname() is proving to be troublesome without the
> following change.
>
> Note: It may be desirable for gethostname.m4 to consider a search for
> the function in the winsock.h file or to provide the prototype for
> gethostname in some .h file somewhere.
>
> ChangeLog Entry:
>
> * xgethostname.c: Provide prototype for gethostname when it is
> otherwise not available.
>
> Index: xgethostname.c
> ===================================================================
> RCS file: /cvsroot/gnulib/gnulib/lib/xgethostname.c,v
> retrieving revision 1.19
> diff -u -p -u -p -r1.19 xgethostname.c
> --- xgethostname.c 9 Aug 2004 23:45:32 -0000 1.19
> +++ xgethostname.c 22 Nov 2004 18:09:24 -0000
> @@ -35,6 +35,12 @@
>
> #include "xalloc.h"
>
> +#ifdef HAVE_WINSOCK_H
> +#include <winsock.h>
> +#elif !HAVE_GETHOSTNAME
This should probably switch on HAVE_GETHOSTNAME_DECL. It's more specific.
Cheers,
Derek
> +int gethostname (char *, int);
> +#endif
> +
> #ifndef ENAMETOOLONG
> # define ENAMETOOLONG 0
> #endif
>
>
> Conrad T. Pino <address@hidden> writes:
>
> >From: "Conrad T. Pino" <address@hidden>
> >To: "Bug CVS" <address@hidden>
> >Date: Mon, 22 Nov 2004 09:22:02 -0800
> >X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0)
> >Subject: CVS Feature Branch - Windows Build Broken -
> lib/xgethostname.c &
> > WinSock
> >Sender: address@hidden
>
> >File "lib/xgethostname.c" calls function "gethostname" which appears
> >not to have a prototype.
>
> >If "#include <winsock.h>" is added to "lib/xgethostname.c" then the
> >issue goes away.
>
> >What is the correct fix?
>
> >--------------------Configuration: libcvs - Win32
> Debug--------------------
> >Compiling...
> >xgethostname.c
> >H:\Conrad\Projects\cvs-1.12\lib\xgethostname.c(67) : warning C4013:
> 'gethostname' undefined; assuming extern returning int
> >Creating library...
> >--------------------Configuration: libdiff - Win32
> Debug--------------------
> >Creating library...
> >--------------------Configuration: cvsnt - Win32
> Debug--------------------
> >Linking...
> >libdiff.lib(xgethostname.obj) : error LNK2001: unresolved external
> symbol _gethostname
> >.\WinDebug\cvs.exe : fatal error LNK1120: 1 unresolved externals
> >Error executing link.exe.
>
> >cvs.exe - 2 error(s), 94 warning(s)
>
> ...
>
> >>From: Mark D. Baushke
> >>
> ... consideration of adding GNULIB gethostname.c to the windows
> build ...
>
> >Doesn't look promising to me since Windows doesn't have "uname"
> >function and "HAVE_UNAME" macro is undefined.
>
> >Adding file resolves link errors but the operative code resulting
> >from conditional compile is
>
> > strcpy (name, ""); /* Hardcode your system name if you
> want. */
>
> >which doesn't look very useful to me.
>
> >>I thought there was a gethostname() function for Windows, but
> >>apparently the nightly test failed for lack of the funciton...
>
> >Not lack of the function, lack of "#include" with the protoype.
>
>
> It seems to be time to ask GNULIB to make a change to xgethostname() if
> posible.
>
> -- Mark
_______________________________________________
Bug-cvs mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-cvs
- --
*8^)
Email: address@hidden
Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBrMUhLD1OTBfyMaQRAs25AKDZtBG9+mGwYq8dz3+d0xMyp8Vl9wCdEBYK
PAtYEgr16Haco9EgUcm0mXc=
=spAc
-----END PGP SIGNATURE-----