
Binary compatibility has to be targeted for post 1.0.0 versions of ParaGUI
Matthias Ettrich from the KDE project has written a very useful document that explains the do's and don'ts.
Here is an excerpt of the most important things:
The dos and don'ts
You can ...
-
add new non-virtual functions.
-
reimplement virtual functions defined in one of the base classes if it is safe that programs linked with the prior version of the library call the implementation in the base class rather than the new one. This is tricky and might be dangerous. Think twice before doing it.
-
change an inline function or make an inline function non-inline if it is safe that programs linked with the prior version of the library call the old implementation. This is tricky and might be dangerous. Think twice before doing it.
-
Remove private non-virtual function if they are not called by any inline functions.
-
add new static data members.
-
add new classes.
You cannot ...
-
add new virtual functions as this will change the layout of the virtual table and thus break subclasses.
-
change the order of virtual functions in the class declaration. This will just as well change the layout of the virtual table.
-
change the signature of a function. Note that extending a function with another parameter, even if this parameter has a default argument, changes the signature and thus is not binary compatible (only source compatible). Simply add another function with the same name and the extended argument list and add a short BCI (binary incompatibiliy issue) note that the two functions shall be merged with a default argument in later versions of the library.
-
change the access rights to some functions, for example from
private
to public
. With some compilers, this information may be part of the signature. If you need to make a private function protected or even public, you have to add a new function that calls the private one.
-
add new data members to a class except static ones.
-
change the class hierachy apart from adding new classes.
Matthias Ettrich ettrich@kde.org
The ParaGUI Project - Alexander Pipelka