winsock2.h

lawson_whitney at juno.com lawson_whitney at juno.com
Tue Nov 20 13:56:54 CST 2001


On Tue, 20 Nov 2001, Francois Gouget wrote:

>    Note that 'unistd.h' does not exist on Windows. So this Winelib app
> is no longer portable and this is why you are having trouble. Do you
> really need to log to syslog in a test application? Wouldn't it be
> simpler to just write to stderr, or fprintf(log_file,...)'? Then
> you can simply #include 'stdio.h' which will work with the winsock
> headers and also compile on Windows.

I didn't say that very well, I guess.  The program that wants unistd.h
functions in my mail system as a linux sendmail.  I don't really care
if it is portable to windows, it only uses windows functions to
manipulate storage objects.  I guess it would have more mass appeal if I
would port it to windows, but I don't know how.  Does windows even have
a sendmail?  A home directory for each user?  That just happened to be
the program I picked to tinker with, which is how I found it doesn't
compile anymore.  Right, windows compatibility is enough of a challenge
for the wine headers, I don't mean to give you more problems.
What I like about winelib is you can use windows functions without being
enslaved by that whole ugly API. :-)
>
> [...]
>
>    Ok. The other reason why it does not work is that I did no realize
> that 'unistd.h' was defining 'gethostname'. The reason for that being
> that I tested the new headers with Wine and real Windows applications
> that of course don't include 'unistd.h'.
>    I had a similar problem with 'stdlib.h' though. So you can look at
> 'winsock.h' to see how I dealt with it. I am not sure whether it is
> worth putting similar code in winsock.h for unistd.h: it would force us
> to #include unistd.h in winsock.h which would pollute the namespace for
> all Winelib application although no regular Windows application is
> supposed to use that header.

Probably not.  I think if I want to use unix functions in winelib apps,
I should be willing to dodge the namespace collisions.

>    You can also deal with unistd.h in your own application by doing:
>
> #define gethostname linux_gethostname
> #include <unistd.h>
> #undef gethostname
>
>     And making sure that unistd.h is included before winsock.h.
>
That looks simple enough.  I'll try that, I think.  Thanks!
>
>
> --
> Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
>                      f u kn rd ts, ur wy 2 gky 4 ur wn gd.
>
Lawson

| We apologize if this message has reached you in error.
| Save the Planet, Save the Trees! Advertise via E mail.





More information about the wine-devel mailing list