From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7453 invoked by alias); 29 Aug 2005 21:57:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7348 invoked by uid 48); 29 Aug 2005 21:57:32 -0000 Date: Mon, 29 Aug 2005 22:14:00 -0000 Message-ID: <20050829215732.7347.qmail@sourceware.org> From: "mmarcus at emarcus dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050829194742.23628.mmarcus@emarcus.org> References: <20050829194742.23628.mmarcus@emarcus.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/23628] Typeinfo comparison code easily breaks shared libs X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg03387.txt.bz2 List-Id: ------- Additional Comments From mmarcus at emarcus dot org 2005-08-29 21:57 ------- Maybe I should rephrase my concern as the following question. Suppose a gcc user is building an application and some shared libraries that depend on third party libraries. Under what circumstances can he safely set visibility to someting other than default, for any types? My current understanding is that it is only safe to do so for types whose typeinfo will he can guarantee will never be shared. This is not always an easy guarantee to make, and so, if my undersatanding is correct, makes hidden visibility much less useful than it first appears. If typeinfo equality was based on string comparison instead of address comparison, the usefuleness of hidden visibility would be greatly increased. This would also address another important use case. There is often a desire to produce a shared library with only an extern "C" ABI, especially when building artifacts designed for long-term binary compatibility. That is, the only visible symbols should be extern "C" functions. To write such a shared library in C++, while depending upon a shared libstdc++ or other shared C++ libraries is not possible if one most make typeinfo visible just to share it with the libraries upon which our library depends. Address-only typeinfo equality comparison has a high usability cost. Would it be possible to first check for address equality, falling back to a string comparison upon failure? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23628