Re: GUC variables invisible to contrib/ modules

Andreas Pflug <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
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



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [email protected])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.