[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare gethostname in unistd.h
From: |
Simon Josefsson |
Subject: |
Re: declare gethostname in unistd.h |
Date: |
Wed, 22 Oct 2008 14:25:20 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) |
Bruno, the patch causes build failures on mingw:
./unistd.h:313: error: conflicting types for 'gethostname'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winsock2.h:635:
error: previous declaration of 'gethostname' was here
The problem is that the native gethostname Win API uses 'int' instead of
'size_t' as the prototype.
Should we replace the system gethostname with a wrapper? Or can we use
a simple #define such as
#define gethostname(name, len) gethostname (name, (int) len)
when using the winsock2.h gethostname definition?
/Simon