Subject: Re: Watcom and ares_iphlpapi.h

Re: Watcom and ares_iphlpapi.h

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Mon, 25 Jul 2011 16:09:21 +0200

"Gisle Vanem" <gvanem_at_broadpark.no> wrote:

>I just did a Git commit of my diffs (using the TortoiseGit shell-extension in
> WinExplorer). It seems to work well.

No, the git commit didn't work; nothing appeared on github. I repeat the
whys and diffs below.

ares_iphlpapi.h: Added "!defined(_WS2DEF_)" since Watcom doesn't have
  a per type guard for the typedefs 'CSADDR_INFO' (that MingW has) or
  'SOCKET_ADDRESS' (that MSVC has). But we can use the header-guard for
  <ws2def.h> instead.

--- Git-latest/ares_iphlpapi.h Mon Jul 25 15:29:08 2011
+++ ares_iphlpapi.h Wed Jul 20 22:53:18 2011
@@ -28,7 +28,10 @@
 #endif

 /* ---------------------------------------------------------- */
-#if !defined(__CSADDR_DEFINED__) && !defined(__CSADDR_T_DEFINED)
+#if !defined(__CSADDR_DEFINED__) && !defined(__CSADDR_T_DEFINED) && \
+ !defined(_WS2DEF_) /* Watcom doesn't have a per-type guard
+ for these types. But we can use the header-guard for
+ <ws2def.h> instead. */
 /* ---------------------------------------------------------- */

 typedef struct _SOCKET_ADDRESS {

----------------------------------------

Makefile.Watcom:
  * The 'NTDDI_VERSION' needs to be raised to 0x05010000
    in order for SOCKADDR_STORAGE etc. to be typedefed.
  * Replaced '-dUSE_WATT32' with '-dWATT32'.
  * Added $(DEMOS) to the 'all' target and removed the 'demos'
    target to be consistent with e.g. Makefile.msvc etc.
  * 'ENABLE_IPV6' is no longer used. Hence removed the '%use_ipv6' construct.
  * object-file order seems to be important (Watcom v.19). Hence 'ares_getopt.obj'
    must be put after the .obj that references getopt().

--- Git-latest/Makefile.Watcom Mon Jul 25 15:29:08 2011
+++ Makefile.Watcom Thu Jul 21 00:19:17 2011
@@ -40,7 +40,7 @@
 
 CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
          -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
- -dNTDDI_VERSION=0x05000100 -I. $(SYS_INCL)
+ -dNTDDI_VERSION=0x05010000 -I. $(SYS_INCL)
 
 LFLAGS = option quiet, map, caseexact, eliminate
 
@@ -52,15 +52,13 @@
 CFLAGS += -d0
 !endif
 
-!ifdef %use_ipv6
-CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
-!endif
+CFLAGS += -d_WIN32_WINNT=0x0501
 
 #
 # Change to suite.
 #
 !ifdef %use_watt32
-CFLAGS += -dUSE_WATT32 -I$(%watt_root)\inc
+CFLAGS += -dWATT32 -I$(%watt_root)\inc
 !endif
 
 OBJ_BASE = WC_Win32.obj
@@ -89,12 +87,9 @@
 ARESBUILDH = ares_build.h
 RESOURCE = $(OBJ_BASE)\dyn\cares.res
 
-all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) .SYMBOLIC
+all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
  @echo Welcome to cares
 
-demos: all $(DEMOS) .SYMBOLIC
- @echo Welcome to cares-demos
-
 $(OBJ_BASE):
  -$(MD) $^@
  -$(MD) $^@\stat
@@ -111,13 +106,13 @@
  $(AR) -q -b -c $^@ @$]@
 
 adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
- $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib
+ $(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
 
 ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
- $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib
+ $(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
 
 acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
- $(LD) name $^@ system nt $(LFLAGS) file { $[@ $(OBJ_BASE)\demos\ares_getopt.obj } library $]@, ws2_32.lib
+ $(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
 
 clean: .SYMBOLIC
  -$(RM) $(OBJS_STAT)

--gv
Received on 2011-07-25