[gnome-love] API and ABI



Hi all,

I'm hacking a bit on libxml and libxslt and I'm faced with the problem of
API and ABI breakage.
Not breaking the API is not really difficult to understand.
What's more difficult to understand is ABI breakage.

I'll take a "live" example:
in libxml, XPath functions are implemented by callbacks with the following
prototype:
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int
nargs);
Functions are registered in a hash table (registering function is passed a
pointer to the function as an argument).

I needed, to implement a new function (as part of libxml), to retrieve
additional information (the local name and namespace URI of the function as
it appears in the XPath expression, so a single callback could catch calls
to multiple XPath functions and chose what to do depending of the function
actually called) that wasn't accessible in the context (ctxt).
There were two possibilities:
 · modifying the xmlXPathParserContext struct (this also implied modifying
   another, internal struct to add a field to it)
 · modifying xmlXPathFunction and add two arguments

I know that if a function to be registered expect less arguments that it is
supposed to be called with (for example, registering a function expecting a
single arg while the registering function expect a pointer to a function
expecting two args), it's not a problem (this is done sometimes in libxml).

So I thought that modifying xmlXPathFunction was the best way: other,
earlier functions (expecting two args) will continue to work and the
context and the other, internal struct won't grow up with a field used only
10% of the time or even less.
Daniel Veillard answered this would break API and ABI compatibility.

So here are my questions:
First, I don't really understand why it breaks the API (?!).
Then I really don't understand the ABI breakage (I don't know much -- I
rather know a very little bit, practically nothing -- about the ABI).

Can someone here enlighten me? Or at least give me pointers to some
documentation?

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]