Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] (PR#4042) 1.14.0: gtk2 compile error with mingw32
Home

[Freeciv-Dev] (PR#4042) 1.14.0: gtk2 compile error with mingw32

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4042) 1.14.0: gtk2 compile error with mingw32
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sun, 20 Apr 2003 13:15:31 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[per - Sun Apr 20 14:54:02 2003]:

> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I./.. -I./../include
> -I../../common -I../../intl -I./../agents
> -If:/pim/mingw/gtk-dev/include/gtk-2.0
> -If:/pim/mingw/gtk-dev/lib/gtk-2.0/include
> -If:/pim/mingw/gtk-dev/include/atk-1.0
> -If:/pim/mingw/gtk-dev/include/pango-1.0
> -If:/pim/mingw/gtk-dev/include/glib-2.0
> -If:/pim/mingw/gtk-dev/lib/glib-2.0/include      -g -O2 -Wall
> -mms-bitfields -c `test -f connectdlg.c || echo './'`connectdlg.c
> connectdlg.c: In function `try_to_autoconnect':
> connectdlg.c:344: `ECONNREFUSED' undeclared (first use in this function)
> connectdlg.c:344: (Each undeclared identifier is reported only once
> connectdlg.c:344: for each function it appears in.)
> make[4]: *** [connectdlg.o] Error 1
> 
> Houston, please advise.

This is a problem in the '-autoconnect' code. I guess when Raimar did it
he did not take Win32 WinSock in mind. In the WinSock sockets
implementation ECONNREFUSED is #defined as WSAECONNREFUSED.
Also, in WinSock, you cannot check this error condition by looking at
the value of 'errno' like in UNIX.
You need to call WSAGetLastError() instead of check 'h_errno' which is a
macro for WSAGetLastError().

This page has more info about the differences between WinSock and BSD
sockets:
http://burks.brighton.ac.uk/burks/pcinfo/progdocs/winsock/winsocka.htm


My suggestion for fixing this is to plain drop returning errno in
try_to_connect() and just return -1 in case of failure. Then in the
clients merge the ECONNREFUSED case with generic -1 return on connect()
case.

Why? Because there are more OSes with freaky BSD socket implementations
than Windows. Examples being AmigaOS AmiTCP and the BeOS emulations.
The less UNIXoid features of BSD sockets we use the better.



[Prev in Thread] Current Thread [Next in Thread]