[taken to wine-devel, thread originally started in newsgroup] gerard patel wrote:
james[1]%rpm -qf /usr/include/unistd.h glibc-devel-2.2.4-19
glibc-devel-2.2.2-4mdk
james[2]%grep gethostname /usr/include/unistd.h extern int gethostname (char *__name, size_t __len) __THROW;
extern int gethostname (char *__name, socklen_t __len) __THROW;
./include/bits/types.h:typedef unsigned int __socklen_t;
This could be a problem. According to the glibc CVS, http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/include/unistd.h.diff?r1=1..., the type of the 2nd argument changed from int to size_t on 2001/3/21. According to the CVS tags, this change was first released in glibc-2.2.3.
We were able to work around this problem in programs/winhelp by not including winsock.h, but could this problem crop up anyplace else? It seems that it is currently impossible to include unistd.h and winsock.h on a machine with glibc >= 2.2.3.
-- James Juran jamesjuran@alumni.psu.edu
On Sun, 2 Dec 2001, James Juran wrote: [...]
We were able to work around this problem in programs/winhelp by not including winsock.h, but could this problem crop up anyplace else? It seems that it is currently impossible to include unistd.h and winsock.h on a machine with glibc >= 2.2.3.
The goal of Winelib is to be able to compile Windows application on Linux to work with Wine. 'unistd.h' does not exist on Windows. Thus Winelib applications do not use 'unistd.h'. And it follows that the above problem cannot happen.
So I think the right thing to do is simply to not use 'unistd.h' in Winelib applications. If you really *must* use 'unistd.h' in a Winelib application then there are other solutions: * define WINE_NOWINSOCK so that winsock2.h is not included by windows.h * define USE_WS_PREFIX so that the symbols defined in winsock.h will not onflict with Unix symbols. Of course, then you may have trouble calling these functions. But USE_WS_PREFIX is primarily intended for applications that want to mingle unix socket calls with winsock socket calls (like Wine) so this is quite normal.
(Note: my newsgroup access does not work very well currently, feel free to forward this to the newsgroup if appropriate)
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Hiroshima '45 - Czernobyl '86 - Windows '95