Writing Shared Libraries, first draft

Mike Hearn mike at navi.cx
Fri Nov 5 22:40:08 EET 2004


Major version is defined at the top of the document so hopefully it's
clear enough.

On Fri, 05 Nov 2004 15:16:04 -0500, Havoc Pennington wrote:
> Parallel install should happen according to a very specific rule: when
> an app asks for an interface by name, it should always get something
> with the same interface and semantics it expected.

I think this quote sums the whole thing up, so I included it in the
document. Thanks.

> > Header versioning isn't required ... if you correctly maintain
> > backwards compatibility within a major version you don't need it. 
> > Applications simply use whatever versions of library they require and
> > check the headers declare them (or pkg-config knows the version is
> > recent enough) in configure.ac
> 
> I agree with that.

Yes ... I can see this one will be a hard sell :) Still, I think the
reasoning given in the article and elsewhere in this thread is sound.
  
> My suggestion would be Only Opaque Objects Allowed. In all my new
> libraries such as libwnck and libdbus, there basically aren't any struct
> fields exposed in the headers, with maybe a couple of special cases.
> This eliminates one of the largest reasons to break ABI and usually
> results in an easier to use API anyhow.

Yes, it can do, at the cost of more entry points for getters/setters. I
don't think public structures is necessarily a bad idea, you can use
private pointers (pimpls) and padding to ensure requiring an ABI break is
very unlikely.
 
thanks -mike




More information about the xdg mailing list