Re: Random PGDLLIMPORTing

From: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Random PGDLLIMPORTing
Date: 2016-11-24 14:25:22
Message-ID: 20161124172522.301a7ae8@fafnir.local.vm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 24 Nov 2016 15:01:33 +0100
Magnus Hagander <magnus(at)hagander(dot)net> wrote:

> On Thu, Nov 24, 2016 at 2:58 PM, Craig Ringer <craig(at)2ndquadrant(dot)com>
> wrote:
>
> > Hi all
> >
> > Noticed this while reading something unrelated
> >
> > extern PGDLLIMPORT pid_t PostmasterPid;
> > extern bool IsPostmasterEnvironment;
> > extern PGDLLIMPORT bool IsUnderPostmaster;
> > extern bool IsBackgroundWorker;
> > extern PGDLLIMPORT bool IsBinaryUpgrade;
> >
> > I don't see any sane reason for some of those to be PGDLLIMPORT but
> > not others. In particular it's pretty silly for IsBackgroundWorker
> > not to be PGDLLIMPORT.
> >
> > Too trivial to be worth making an actual patch, it'd be more work to
> > apply it than edit directly.
> >
>
> My guess is that PGDLLIMPORT has been added explicitly when somebody
> needed it for something, without any actual thought. I can't say I
> see any reason not to export the other ones as well -- more that
> maybe there are even more that are needed?
>

It worth checking actual variable definitions, not just declarations.
I've found recently, that at least in MSVC build system, only
initialized variables are included into postgres.def file, and so are
actually exported from the backend binary.

But in this case both IsPostmasterEnvironment and IsBackgroundWorker
are initialized. So probably they are not marked as importable only for
historic reason.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2016-11-24 14:39:54 Re: Creating a DSA area to provide work space for parallel execution
Previous Message Bruce Momjian 2016-11-24 14:18:43 Re: Physical append-only tables