libpq build problem with on MS VC++ 7.0

Поиск
Список
Период
Сортировка
От Andrew Francis
Тема libpq build problem with on MS VC++ 7.0
Дата
Msg-id 4119C627.5030402@familyhealth.com.au
обсуждение исходный текст
Список pgsql-hackers-win32
Hi all

When building libpq using Visual Studio .NET 2002 (ie Visual C++ 7.0), I 
encounter this error:

fe-lobj.c
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\io.h(205) : error 
C2375: 'pgrename' : redefinition; different linkage
         c:\libs\postgresql\src\include\port.h(148) : see declaration of 
'pgrename'
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\io.h(275) : error 
C2375: 'pgunlink' : redefinition; different linkage
         c:\libs\postgresql\src\include\port.h(149) : see declaration of 
'pgunlink'


As rename/unlink are #define'd to pgrename/pgunlink prior to <io.h>'s inclusion.


Simply reordering the headers fixes the problem (see attachment).


I believe this may be a problem on my compiler, but not necessarily others, 
due to an additional compiler directive on the definition in io.h:

   #define _CRTIMP __declspec(dllimport)
      ...
   _CRTIMP int __cdecl unlink(const char *);

port.h's definition of pgrename() is obviously lacking a __declspec(dllimport).


Regards,

-- 
Andrew Francis
Lead Developer - Software
Family Health Network


*** fe-lobj-old.c    Wed Aug 11 14:56:16 2004
--- fe-lobj.c    Wed Aug 11 14:55:55 2004
***************
*** 13,33 ****
   *-------------------------------------------------------------------------
   */
- #include "postgres_fe.h"
  
! #include <fcntl.h>
! #include <sys/stat.h>
! #include <errno.h>
  
  #ifdef WIN32
  #include "win32.h"
- #include "io.h"
  #else
  #include <unistd.h>
  #endif
  
  #include "libpq-fe.h"
  #include "libpq-int.h"
  #include "libpq/libpq-fs.h"        /* must come after sys/stat.h */
- 
  
  #define LO_BUFSIZE          8192
--- 13,40 ----
   *-------------------------------------------------------------------------
   */
  
! #ifdef WIN32
! /*
!  * As unlink/rename are #define'd in port.h (via postgres_fe.h), io.h
!  * must be included first.
!  */
! #include <io.h>
! #endif
! 
! #include "postgres_fe.h"
  
  #ifdef WIN32
  #include "win32.h"
  #else
  #include <unistd.h>
  #endif
  
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <errno.h>
+ 
  #include "libpq-fe.h"
  #include "libpq-int.h"
  #include "libpq/libpq-fs.h"        /* must come after sys/stat.h */
  
  #define LO_BUFSIZE          8192

В списке pgsql-hackers-win32 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PITR on Win32 - Archive and Restore
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Win32 PostgreSQL 8.0 Beta 1 Installer available for download