Re: Add missing PGDLLIMPORT markings - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Add missing PGDLLIMPORT markings
Date
Msg-id 968FFBF1-3CF4-4DE7-9D07-AE5CBB8FFE43@anarazel.de
Whole thread Raw
In response to Re: Add missing PGDLLIMPORT markings  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Add missing PGDLLIMPORT markings
List pgsql-hackers
Hi,

On April 9, 2025 12:58:23 PM EDT, Robert Haas <robertmhaas@gmail.com> wrote:
>On Wed, Apr 9, 2025 at 11:28 AM Andres Freund <andres@anarazel.de> wrote:
>> FWIW, the AIO ones really don't make sense to make public - the only reason
>> for those variables to exists is so they can be put into an array of
>> callbacks. There's no way an extension could ever benefit from them.  But I
>> guess we don't really have a way to tell mark_pgdllimport.pl that.
>
>I'm not here to say that you're wrong, but this kind of argument is
>exactly why we didn't use to mark a bunch of things PGDLLIMPORT that,
>as it turned out, extension developers actually wanted to use.
>
>I don't think we should go back to the bad old days where we litigated
>every case of marking something PGDLLIMPORT or not unless we have an
>extremely good reason for so doing.

Yeah, that's why I guessed that we will have to just mark these.

Fwiw, just marking everything is far from free. We prevent optimizations the compiler could make otherwise. Except of
coursethat we have implicitly always done so in the main binary on ELF platforms, so "PGDLLIMPORT everything" kind of
justremoved the portability hazard. 

I think eventually we ought to change the default visibility in the main binary to hidden, just like we do for
extensions.Then the windows/everything else behavior difference vanishes and we actually get the benefit of being more
restrictiveon common platforms.  I think we  still ought to default to exporting symbols in such a world, just not
alwaysdo so.  We probably should just require all externs are either marked "server only" or "visible to extensions",
neverjust a plain extern. 

Greetings,

Andres


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Draft for basic NUMA observability
Next
From: Nathan Bossart
Date:
Subject: Re: Horribly slow pg_upgrade performance with many Large Objects