Re: On non-Windows, hard depend on uselocale(3)

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: On non-Windows, hard depend on uselocale(3)
Дата
Msg-id 20231118000323.44rduqyxzybil4hk@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: On non-Windows, hard depend on uselocale(3)  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
Hi,

On 2023-11-17 08:57:47 +1300, Thomas Munro wrote:
> I also had a go[3] at doing it with static inlined functions, to avoid
> creating a load of new exported functions and associated function call
> overheads.  It worked fine, except on Windows: I needed a global
> variable PGTYPESclocale that all the inlined functions can see when
> called from ecpglib or pgtypeslib code, but if I put that in the
> exports list then on that platform it seems to contain garbage; there
> is probably some other magic needed to export non-function symbols
> from the DLL or something like that, I didn't look into it.  See CI
> failure + crash dumps.

I suspect you'd need __declspec(dllimport) on the variable to make that work.
I.e. use PGDLLIMPORT and define BUILDING_DLL while building the libraries, so
they see __declspec (dllexport).  I luckily forgot the details, but functions
just call into some thunk that does necessary magic, but that option doesn't
exist for variables, so the compiler/linker have to do stuff, hence needing
__declspec(dllimport).

Greetings,

Andres Freund



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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Change GUC hashtable to use simplehash?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Change GUC hashtable to use simplehash?