RE: BUG #18219: libpq does not take into consideration UNICODE define

Поиск
Список
Период
Сортировка
От Jeff Laing
Тема RE: BUG #18219: libpq does not take into consideration UNICODE define
Дата
Msg-id CH0PR07MB8889D75C9204CC394BF76F6E8A87A@CH0PR07MB8889.namprd07.prod.outlook.com
обсуждение исходный текст
Ответ на Re: BUG #18219: libpq does not take into consideration UNICODE define  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-bugs

Looks like there is a mix to me…

 

c:\...mumble…> dumpbin.exe /imports libpq.dll | grep A$

                          23 InitializeSecurityContextA

                           1 AcquireCredentialsHandleA

                         26A GetModuleHandleA

                         3A8 LoadLibraryA

                         237 GetFileAttributesA

                          BA CreateFileA

                         3A9 LoadLibraryExA

                         19F FormatMessageA

                         179 GetUserNameA

                          CC SHGetFolderPathA

 

c:\mumble…> dumpbin.exe /imports libpq.dll | grep W$

                         2C5 GetStartupInfoW

                         26D GetModuleHandleW

 

From: Thomas Munro <thomas.munro@gmail.com>
Sent: Monday, December 4, 2023 9:20 AM
To: Jan Březina <2janbrezina@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18219: libpq does not take into consideration UNICODE define

 

On Mon, Dec 4, 2023 at 8: 56 AM Jan Březina <2janbrezina@ gmail. com> wrote: > The project is not misconfigured. Windows applications use MBCS (multi byte character set) or UNICODE defines to specify what Windows API they are using and

On Mon, Dec 4, 2023 at 8:56 AM Jan Březina <2janbrezina@gmail.com> wrote:
> The project is not misconfigured. Windows applications use MBCS (multi byte character set) or UNICODE defines to specify what Windows API they are using and there are good reasons not to mix the two.
> You should read the following documentation:
> https://urldefense.com/v3/__https://learn.microsoft.com/en-us/windows/win32/intl/unicode-in-the-windows-api__;!!LlG_G4lo9h6Y!NGBMDMpFtxNbtb155g1HCcZB7if4EEXqwlnDws8-7_cM4q7QKLQtHy960vxoB2eM1FGocuofqDDQHEKE9HLunNjlOeY$
> and mainly
> https://urldefense.com/v3/__https://learn.microsoft.com/en-us/windows/win32/intl/conventions-for-function-prototypes__;!!LlG_G4lo9h6Y!NGBMDMpFtxNbtb155g1HCcZB7if4EEXqwlnDws8-7_cM4q7QKLQtHy960vxoB2eM1FGocuofqDDQHEKE9HLupjSS5eI$
 
We know about that stuff at least in general terms, but we are arguing
that *we* should be in control of whether our .c files are compiled
with UNICODE defined, not someone compiling our library.  That advice
is about applications.  libpq is a shared library.
 
But let's actually check the cost of this:
 
> So if you are not planning to support UNICODE define, then you should be concrete in what Windows API you are using and call the **A (ANSI) API directly, as I suggested. It is a correct way, doesn't conflict with any defines and doesn't conflict with any standard API, as UNICODE define affects only the behavior of Windows API.
> I bet there won't be so much work to fix this, as Windows specific implementations are in separate *win32.c files and hence it should not affect any other platforms and it has to work with every compiler, as it is the standard Windows API.
 
What symbols is libpq.dll referencing?  Maybe "dumpbin /imports
libpq.dll" can tell you?  I guess that'd show us how many *A /*W
functions are reached, and would be changed to call *A directly.  If
it's really just Win32 APIs that are in Windows-only code paths that'd
be one thing.  I wasn't sure if it might also include standard C-ish
code that is shared with Unix.
 
 

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: BUG #18219: libpq does not take into consideration UNICODE define
Следующее
От: Ba Jinsheng
Дата:
Сообщение: Re: Re:BUG #18221: Unexpected Query Result