[Xcb] hidden-visibility and library size

Josh Triplett josh at freedesktop.org
Tue Dec 27 21:05:20 PST 2005

Jamey Sharp wrote:
> On Wed, Dec 28, 2005 at 12:14:46AM +0100, Vincent Torri wrote:
>>Of course, we need to specify all the exported functions. There's an
>>example in xcb.h.diff.
> Oh, so that's how the visibility stuff works. OK. Thanks for putting
> this together!
> I think setting visibility hidden by default is the wrong choice here.
> Instead of setting any compile flags or touching any public header
> files, just fix xcbint.h so that everything there is marked either
> hidden or internal. For XCB, internal should always be safe (we never
> expose to external code pointers to internal functions) and buys us some
> more speed and code size improvements.

I tend to disagree.  Hidden by default means that if you forget to mark
something as visible, it stays hidden, meaning that it is far easier to
unintentionally make a symbol hidden than to unintentionally make a
symbol visible.  The consequence of an unintentionally hidden symbol is
easy to notice (since applications will fail to compile), and the fix is
simply to make it visible, which doesn't affect library backward
compatibility.  The consequence of an unintentionally visible symbol is
hard to notice (and might not be noticed until people start using it),
and the fix causes a backward-incompatible change to the library.  I
think we should have symbols hidden by default, and mark the public API
as non-hidden.

- Josh Triplett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20051227/965f81d8/signature.pgp

More information about the Xcb mailing list