Re: [pgsql-hackers-win32] libpq build problem with on MS VC++ - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [pgsql-hackers-win32] libpq build problem with |
Date | |
Msg-id | 200408170243.i7H2hP602857@candle.pha.pa.us Whole thread Raw |
Responses |
Re: [pgsql-hackers-win32] libpq build problem with |
List | 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@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/interfaces/libpq/fe-lobj.c =================================================================== RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-lobj.c,v retrieving revision 1.48 diff -c -c -r1.48 fe-lobj.c *** src/interfaces/libpq/fe-lobj.c 5 Mar 2004 01:53:59 -0000 1.48 --- src/interfaces/libpq/fe-lobj.c 17 Aug 2004 02:41:10 -0000 *************** *** 12,35 **** * *------------------------------------------------------------------------- */ - #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 static int lo_initialize(PGconn *conn); --- 12,43 ---- * *------------------------------------------------------------------------- */ ! #ifdef WIN32 ! /* ! * As unlink/rename are #define'd in port.h (via postgres_fe.h), io.h ! * must be included first on MS C. Might as well do it for all WIN32's ! * here. ! */ ! #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 static int lo_initialize(PGconn *conn);
pgsql-patches by date: