]> granicus.if.org Git - postgresql/commitdiff
Disble some Win32-specific code in win32-client-only builds:
authorBruce Momjian <bruce@momjian.us>
Thu, 8 Dec 2005 17:52:11 +0000 (17:52 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 8 Dec 2005 17:52:11 +0000 (17:52 +0000)
I have the problem, when building by MS-VC6.
An error occurs in the 8.1.0 present source codes.

nmake -f win32.mak
..\..\port\getaddrinfo.c(244) : error C2065: 'WSA_NOT_ENOUGH_MEMORY'
..\..\port\getaddrinfo.c(342) : error C2065: 'WSATYPE_NOT_FOUND'

This is used by winsock2.h. However, Construction of a windows base is
winsock.h.
Then, Since MinGW has special environment, this is right. but, it is not
found in VC6.
Furthermore, in getaddrinfo.c, IPV6-API is used by
LoadLibraryA("ws2_32");
Referring to of dll the external memory generates this violation by VC6
specification.

I considered whether the whole should have been converted into winsock2.
However, Now, DLL of MinGW creation operates wonderfully as it is.
That's right, it has pliability by replacement of simple DLL.
Then, I propose the system using winsock(non IPV6) in construction of
VC6.

Hiroshi Saito

src/bin/pg_config/win32.mak
src/include/getaddrinfo.h
src/port/getaddrinfo.c

index f00f3012550b6ed6c090a12ec0d6b5d8c31eece8..77726a2dfce33f5ad378cebbe7375c164143bb6b 100644 (file)
@@ -55,7 +55,7 @@ CPP_SBRS=.
 
 LINK32=link.exe
 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ advapi32.lib shell32.lib shfolder.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
  odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
  /pdb:"$(OUTDIR)\pg_config.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\pg_config.exe" 
 LINK32_OBJS= \
index f0a3a82020793b97ada78bb9b02f7029f44593ed..956dc81c4230912b6f201607ab1dd1b5b5331ea2 100644 (file)
@@ -15,7 +15,7 @@
  *
  * Copyright (c) 2003-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.17 2005/10/15 02:49:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.18 2005/12/08 17:52:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #define EAI_MEMORY             (-10)
 #define EAI_SYSTEM             (-11)
 #else                                                  /* WIN32 */
+#if defined(WIN32_CLIENT_ONLY)
+#define WSA_NOT_ENOUGH_MEMORY   (WSAENOBUFS)
+#define WSATYPE_NOT_FOUND       (WSABASEERR+109)
+#endif
 #define EAI_AGAIN              WSATRY_AGAIN
 #define EAI_BADFLAGS   WSAEINVAL
 #define EAI_FAIL               WSANO_RECOVERY
index 49a7293dec664211bf6c244cdab6a0d9fdb94572..89a073c6a8e03d62cc1cea0b07f398d53659a75a 100644 (file)
@@ -16,7 +16,7 @@
  * Copyright (c) 2003-2005, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.21 2005/10/15 02:49:51 momjian Exp $
+ *       $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.22 2005/12/08 17:52:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,6 +40,7 @@
 
 #include <windows.h>
 
+#if !defined(WIN32_CLIENT_ONLY)
 /*
  * The native routines may or may not exist on the Windows platform we are on,
  * so we dynamically look up the routines, and call them via function pointers.
@@ -129,6 +130,7 @@ haveNativeWindowsIPv6routines(void)
        return (getaddrinfo_ptr != NULL);
 }
 #endif
+#endif
 
 
 /*
@@ -149,7 +151,7 @@ getaddrinfo(const char *node, const char *service,
                           *psin;
        struct addrinfo hints;
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
 
        /*
         * If Windows has native IPv6 support, use the native Windows routine.
@@ -272,7 +274,7 @@ freeaddrinfo(struct addrinfo * res)
 {
        if (res)
        {
-#ifdef WIN32
+#if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
 
                /*
                 * If Windows has native IPv6 support, use the native Windows routine.
@@ -364,7 +366,7 @@ getnameinfo(const struct sockaddr * sa, int salen,
                        char *node, int nodelen,
                        char *service, int servicelen, int flags)
 {
-#ifdef WIN32
+#if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
 
        /*
         * If Windows has native IPv6 support, use the native Windows routine.