Re: [pgsql-hackers-win32] Win32 & NLS - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: [pgsql-hackers-win32] Win32 & NLS
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE475F19@algol.sollentuna.se
Whole thread Raw
List pgsql-patches
>> Test program attached, results below. It returns NULL for
>> whatever I try with LC_MESSAGES.
>
>It looks like LC_MESSAGES just plain does not work on Windows.  I did
>some googling and found some pages suggesting this, for instance
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-u
> s/vclib/html/_crt_setlocale.2c_._wsetlocale.asp

Yes, that's exactly the link I had in my original mail.


> The patch you suggest looks remarkably ugly; in particular it is
> generally unsafe to pass a local variable to putenv.  Perhaps that
> does not matter on Windows but I wonder whether the putenv part
couldn't
> just be dropped.

I got that from the gettext FAQ.
The problem is that MSVCRT caches the environment, and that's what you
access using getenv() and putenv(). And this is what gettext uses
internally. The API call is to change the actual process environment.
That's why you need both.

As for the dangers of passing a local variable - there is nothing abot
that in the putenv documentation on MSDN. So I would assume it's safe on
windows.


>  And why bother with ZeroMemory?

Oops. that's a leftover from some previous hacking.

//Magnus

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] Win32 & NLS
Next
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] Win32 & NLS