libpq build problem with <io.h> on MS VC++ 7.0

From: Andrew Francis <locust(at)familyhealth(dot)com(dot)au>
To: pgsql-hackers-win32(at)postgresql(dot)org
Subject: libpq build problem with <io.h> on MS VC++ 7.0
Date: 2004-08-11 07:09:27
Message-ID: 4119C627.5030402@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32 pgsql-patches

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

Attachment Content-Type Size
fe-lobj-fix.diff text/plain 1.1 KB

Responses

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Dave Page 2004-08-11 07:28:41 Re: pg_autovacuum Win32 Service Code
Previous Message Christian Traber 2004-08-11 05:53:20 Re: error moving table to tablespace (8.0 beta win32 )

Browse pgsql-patches by date

  From Date Subject
Next Message Martin Münstermann 2004-08-11 07:56:12 Re: 8.0.0beta1: -lpthread missing
Previous Message Serguei Mokhov 2004-08-11 04:59:35 Translation updates: pg_ctl-ru.po.gz