Writing Shared Libraries, first draft
mike at navi.cx
Thu Nov 4 23:55:28 EET 2004
On Thu, 04 Nov 2004 16:49:46 -0500, Matthias Clasen wrote:
> I think you overemphasize the usefulness of symbol versioning.
> It is much better to avoid the need for different symbol versions.
Symbol versioning is pushed mostly for the metadata it adds. It lets RPM
and the dynamic linker know about minor versions, which is a good thing.
I don't know any other way to do that.
I don't advocate glibc style versioning where you break backwards
compatibility but don't change the soname. That isn't portable, and has a
few other problems too.
> You could maybe add something about avoiding accidentally exporting
> symbols, cf the abi checking we recently introduced in glib and gtk+.
Using a version script should do that, AFAIK:
Now all the symbols that aren't in the global section should be hidden.
> Maybe you also want to mention that it is a good idea to avoid
> unnecessary PLT entries, and point out some ways of achieving that (or
> just point to Ulrichs paper).
Yes that's possible. I didn't want to overwhelm people though. Also I'm
not fully convinced the header file hack Arjan produced is the right way
forward, as far as I know gcc has been extended to make that a lot
cleaner. I should probably add something about that way if it's shipping
in mainstream gcc distributions.
> Does the scope of your document include dos/don'ts for making sure the
> api is language binding friendly ?
Nope. I don't know much about that. It should probably have such a section
though - could you write one?
More information about the xdg