Thread: problem in MS-VC6 environment.

problem in MS-VC6 environment.

From
"Hiroshi Saito"
Date:
Hi Dave-san and Bruce-san.

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.

By this patch, the construction by VC6 finished obediently.

I may have some misapprehensions.Therefore, your suggestion is desired.
Thank you in advance for your understanding.

Regards,
Hiroshi Saito


Attachment

Re: problem in MS-VC6 environment.

From
Bruce Momjian
Date:
Patch applied to CVS HEAD and 8.1.X.  Thanks.

I used WIN32_CLIENT_ONLY rather than _MSC_VER because that covers both
MSC and Borland C.  Updated patch attached.

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


Hiroshi Saito wrote:
> Hi Dave-san and Bruce-san.
>
> 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.
>
> By this patch, the construction by VC6 finished obediently.
>
> I may have some misapprehensions.Therefore, your suggestion is desired.
> Thank you in advance for your understanding.
>
> Regards,
> Hiroshi Saito
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/pg_config/win32.mak
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_config/win32.mak,v
retrieving revision 1.3
diff -c -c -r1.3 win32.mak
*** src/bin/pg_config/win32.mak    27 Sep 2005 17:39:33 -0000    1.3
--- src/bin/pg_config/win32.mak    8 Dec 2005 17:47:49 -0000
***************
*** 55,61 ****

  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\
   odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
   /pdb:"$(OUTDIR)\pg_config.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\pg_config.exe"
  LINK32_OBJS= \
--- 55,61 ----

  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.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: src/include/getaddrinfo.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/getaddrinfo.h,v
retrieving revision 1.17
diff -c -c -r1.17 getaddrinfo.h
*** src/include/getaddrinfo.h    15 Oct 2005 02:49:41 -0000    1.17
--- src/include/getaddrinfo.h    8 Dec 2005 17:47:49 -0000
***************
*** 42,47 ****
--- 42,51 ----
  #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: src/port/getaddrinfo.c
===================================================================
RCS file: /cvsroot/pgsql/src/port/getaddrinfo.c,v
retrieving revision 1.21
diff -c -c -r1.21 getaddrinfo.c
*** src/port/getaddrinfo.c    15 Oct 2005 02:49:51 -0000    1.21
--- src/port/getaddrinfo.c    8 Dec 2005 17:47:50 -0000
***************
*** 40,45 ****
--- 40,46 ----

  #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,134 ****
--- 130,136 ----
      return (getaddrinfo_ptr != NULL);
  }
  #endif
+ #endif


  /*
***************
*** 149,155 ****
                 *psin;
      struct addrinfo hints;

! #ifdef WIN32

      /*
       * If Windows has native IPv6 support, use the native Windows routine.
--- 151,157 ----
                 *psin;
      struct addrinfo hints;

! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)

      /*
       * If Windows has native IPv6 support, use the native Windows routine.
***************
*** 272,278 ****
  {
      if (res)
      {
! #ifdef WIN32

          /*
           * If Windows has native IPv6 support, use the native Windows routine.
--- 274,280 ----
  {
      if (res)
      {
! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)

          /*
           * If Windows has native IPv6 support, use the native Windows routine.
***************
*** 364,370 ****
              char *node, int nodelen,
              char *service, int servicelen, int flags)
  {
! #ifdef WIN32

      /*
       * If Windows has native IPv6 support, use the native Windows routine.
--- 366,372 ----
              char *node, int nodelen,
              char *service, int servicelen, int flags)
  {
! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)

      /*
       * If Windows has native IPv6 support, use the native Windows routine.