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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Francis <locust(at)familyhealth(dot)com(dot)au>, 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 04:33:58
Message-ID: 200408170433.i7H4XwE28420@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32 pgsql-patches

Bruce Momjian wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > > The only other option I can think of is to #undef those to defines,
> > > > include io.h, then re-include port.h? Is that better?
> > >
> > > How about not #define'ing rename() etc in port.h in the first place?
> > >
> > > We could put
> > > #ifdef WIN32
> > > #define rename(x) pgrename(x)
> > > #endif
> > > into those very few .c files that need it. (I'm assuming that
> > > forgetting to include this in a file that calls rename() will yield an
> > > obvious build failure on Windows --- if not then the idea is no good.)
> >
> > I think they have rename --- it just isn't reliable like ours is.
>
> One other thing we could do is to do the out-of-order includes only for
> MS VC. That is the only platform that needs it, and let the other
> Win32's do the regular include.

Ah, one thing we have done is to reference everything as pg* and define
it to be the libc function on unix and give a compatibility function on
Win32. We do that with pgpipe. That might be our best solution.

Personally I never liked defining _away_ from libc function names
(rename -> pgrename), but I think defining _to_ libc names is fine.

Let me fix this tomorrow. I always felt we had too many tricks in
adding these functions and was never sure we had it consistent.

--
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

In response to

Responses

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2004-08-17 04:42:50 Re: libpq build problem with <io.h> on MS VC++
Previous Message Bruce Momjian 2004-08-17 04:24:59 Re: libpq build problem with <io.h> on MS VC++

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-08-17 04:42:50 Re: libpq build problem with <io.h> on MS VC++
Previous Message Bruce Momjian 2004-08-17 04:24:59 Re: libpq build problem with <io.h> on MS VC++