Include only needed headers in programs/winhelp

James Juran jamesjuran at
Sun Dec 2 14:51:01 CST 2001

Francois Gouget wrote:
> On Sun, 2 Dec 2001, James Juran wrote:
> > James Juran <jamesjuran at>
> > Only include the necessary files to avoid conflicts in gethostname
> > prototypes between winsock.h and unistd.h
>    'unistd.h' does not exist on Windows. Since this is a Winelib
> application it would be good to try to make it compile on Windows
> too. So I would rather be in favor of removing the 'unistd.h' #include
> directive unless something prevents that.

<unistd.h> is only included in lex.yy.c, which is generated by flex from
macro.lex.l.  Flex includes <unistd.h> to get the definition of
isatty().  The original compilation error was in compiling lex.yy.c,
which includes unistd.h and macro.h.  macro.h included windows.h, which
included winsock.h, which created the conflict on the gethostname()

So it seems the real conflict is in using flex in Winelib applications
that (directly or indirectly) include windows.h on systems with glibc >=
2.2.3.  Since I would think that flex wouldn't be used to port a real
Windows application to Wine, I would think this isn't a significant

Unless someone knows a way to keep flex from including unistd.h, I think
this patch is still necessary.


James Juran
jamesjuran at

More information about the wine-devel mailing list