Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7OA1-0006hu-V1 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jan 2022 20:54:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7OA0-0005Q9-Gj for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jan 2022 20:54:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7OA0-0005Pz-7R for pgsql-hackers@lists.postgresql.org; Tue, 11 Jan 2022 20:54:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7O9y-0007IW-5r for pgsql-hackers@postgresql.org; Tue, 11 Jan 2022 20:54:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20BKsJQv2767067; Tue, 11 Jan 2022 15:54:19 -0500 From: Tom Lane To: Andres Freund cc: Justin Pryzby , Laurenz Albe , pgsql-hackers@postgresql.org Subject: Re: Use -fvisibility=hidden for shared libraries In-reply-to: <20220111054252.oq5afaf5kxiojf7j@alap3.anarazel.de> References: <20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de> <20211101054700.z3jzmc5lnxlad4y7@alap3.anarazel.de> <2499085.1641859296@sss.pgh.pa.us> <20220111031107.GU14051@telsasoft.com> <20220111033133.k5cj63ywz64oxj4y@alap3.anarazel.de> <2533117.1641876246@sss.pgh.pa.us> <20220111054252.oq5afaf5kxiojf7j@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 10 Jan 2022 21:42:52 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2767065.1641934459.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 11 Jan 2022 15:54:19 -0500 Message-ID: <2767066.1641934459@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > What is bugging me is that I am fairly sure that my local compilers at s= ome > point complained about such mismatches on linux as well. But I can't rep= roduce > that right now :/ > Now I wonder if I just saw it when cross compiling locally... I still don't understand what are the conditions for MSVC to complain. The rule is evidently not that every extern must agree with the function definition, because for example you added +extern PGDLLEXPORT void _PG_init(void); in fmgr.h, but you didn't change any of the existing extern declarations or definitions for _PG_init functions, and yet everything seems to work. I had concluded that gcc/clang follow the rule "use an attribute if it appears on at least one extern for the function", and this seems like evidence that it works like that in MSVC too. regards, tom lane