sahib/glyr — pull request #25 by emillon (2012-05-01 19:53:39+00:00)
Title: Restrict visibility of exported symbols

Hello !

I am finishing the official debian package for glyr. The fact is that it is best for libraries to have a clear API (so that their dependencies can expect not to be broken too often). This patch restricts what symbols are exported in libglyr1.so. I chose to export those who start with `glyr_`, the full list is in [this file](https://github.com/emillon/glyr-debian/blob/master/debian/libglyr1.symbols). Commit message follows.

Cheers & thanks for your library !

---

By default, GCC makes every symbol in the .so visible. However, to avoid clashes
and maintain a clear API it is better to export only a whitelist.

This patch does two things and a hack :

- set the default visibility to "hidden".
- annotate some exported functions to "default", ie. externally visible.

- (the hack) adjust src/glyrc/autohelp.c so that it links directly against
stringlib objects (instead of linking through libglyr)

The last point is certainly questionable. The problem is that a few functions
from stringlib are referenced in autohelp.c. An alternative solution could be to
rename get_next_word into glyr_get_next_word and make it part of the public API,
but that's not ideal either.