Say you're working on the source of a library that needs to maintain ABI compatibility. This library has a .c file that defines a static
function like so:
static int
wl_message_count_arrays(const struct wl_message *message)
{
// ...
}
This function is not exposed in any exported headers, but I would like to expose it in a private header. To do so, the function can not be marked static
. Would removing the static
modifier of the function signature change the ABI?
I think there are several points to consider:
Does it change the ABI?
Yes, because now there is a new public symbol. There's no difference between adding a new function and removing static
from an existing function as far as the ABI is concerned.
Does it break compatibility?
It definitely does in the other direction: Programs linked against the new version of the library that make use of the new symbol won't run with older versions of the library.
OK, but what about users of the old library that want to upgrade?
In that case there's a possibility that they define a symbol with the same name themselves, leading to conflicts with the new library. Technically this is a breaking change.
But if the symbol is "namespaced" (e.g. if all the names from the library use a foo_
prefix and the new symbol does, too), then I'd consider this change morally non-breaking and the new ABI compatible with the old one.