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

Andrew Francis <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32,gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
Tom Lane wrote:
> Bruce Momjian <[email protected]> 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.

How about avoiding #define altogether, and:

  - Always use pgrename/pgunlink instead of rename/unlink

  - Provide stubs for non-Win32 systems

#ifndef WIN32
int pgrename(const char *from, const char *to) {
   return rename(from,to);
}
#endif

#define is evil, afterall.

-- 
Andrew Francis
Lead Developer - Software
Family Health Network


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.