Re: GUC variables invisible to contrib/ modules

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема Re: GUC variables invisible to contrib/ modules
Дата
Msg-id 411A460F.1020500@pse-consulting.de
обсуждение исходный текст
Ответ на GUC variables invisible to contrib/ modules under Win32  ("Mark Cave-Ayland" <m.cave-ayland@webbased.co.uk>)
Список pgsql-hackers-win32
Mark Cave-Ayland wrote:
> Under Linux, PostGIS compiles and links fine without any trouble.
> However, when compiling under Win32 we get the following message:
>
> Info: resolving _default_statistics_target by linking to
> __imp__default_statistics_target (auto-import)
> fu000024.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
> nmth000023.o(.idata$4+0x0): undefined reference to
> `_nm__default_statistics_target'
> c:\mingw\bin\dllwrap.exe: c:\mingw\bin\gcc exited with status 1
>
>
> The current "fix" to enable this to work correctly is to change the
> relevant line in /src/include/commands/vacuum.h from "extern int
> default_statistics_target;" to "extern DLLIMPORT int
> default_statistics_target;". However, I'm not convinced this is the
> correct fix given that other contrib modules may require access to other
> GUC variables.


It would be fine if all non-static variables would be defined
extern DLLIMPORT, but since non-backend modules don't regularly access
those variables most won't have that keyword. Additionally, this is yet
another M$ issue, non-existent anywhere else.

A work around is to redefine the prototype when you use it, i.e. after
all pgsql includes you define
extern DLLIMPORT int default_statistics_target;
in your sources. Apparently, the compiler will respect the latest
definition and resolve the reference cleanly.

Regards,
Andreas



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

Предыдущее
От: "Mark Cave-Ayland"
Дата:
Сообщение: GUC variables invisible to contrib/ modules under Win32
Следующее
От: "Tom Haddon"
Дата:
Сообщение: Import from Linux to Windows