Re: Building with Visual C++ - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: Building with Visual C++
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA352E3@algol.sollentuna.se
Whole thread Raw
In response to Building with Visual C++  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-patches
> > I've been working on getting the full backend to compile
> and run using
> > Visual C++ instead of mingw/gcc, and have made some good progress.
> >
>
> This is great!

Thanks.


> > *) Add s_lock implementation based on InterlockedCompareExchange
> > instead of assembly code (gcc style asm not supported, and
> this should
> > probably be about as fast from what I hear)
>
> _InterlockedCompareExchange is even better IMHO ...

I could've sworn the non-_ was #defined to the other one, but
double-checkign that I see that's only done on 64-bit systems. Will
update.


> > src/port/dirent.c - opendir/readdir/closedir implementation
> for win32,
> > that doesn't even have the bugs mingw had in it ;)
>
> But seems it has a typo ;-) Check out this line:
>
>    errno = GetLastError();

Argh. That was one point where I was lazy.

The solution to that is of course to use _dosmaperr(). The problem is
that _dosmaperr is in backend/port/error.c, but dirent is needed both in
frontend and backend.
To fix this, I suggest we move _dosmaperr() into src/port instead.
Probably renaming the file to win32error.c in the process. (The other
way would be to explicitly reference that file from the utils that need
dirent, but that just seems way ugly)
Thoughts?

//Magnus

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Additional current timestamp values
Next
From: "Magnus Hagander"
Date:
Subject: Re: Building with Visual C++