From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Andrew Francis <locust(at)familyhealth(dot)com(dot)au> |
Cc: | pgsql-hackers-win32(at)postgresql(dot)org, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: libpq build problem with <io.h> on MS VC++ |
Date: | 2004-08-17 02:43:25 |
Message-ID: | 200408170243.i7H2hP602857@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers-win32 pgsql-patches |
OK, I have improved your comment and applied the patch. I mentioned the
problem is only on MS C, but we might as well include io.h there on all
Win32 platforms.
---------------------------------------------------------------------------
Andrew Francis wrote:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 1.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-08-17 02:51:09 | Re: GUC variables invisible to contrib/ modules |
Previous Message | Tom Lane | 2004-08-16 23:05:05 | Re: our friend the win32 system timer. |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-08-17 02:51:09 | Re: GUC variables invisible to contrib/ modules |
Previous Message | Marc G. Fournier | 2004-08-16 23:55:53 | Re: Postgresql.conf Documentation change |