Reference:
https://www.acodersjourney.com/20-abi-breaking-changes/
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
https://community.kde.org/Policies/Binary_Compatibility_Examples
Each of these items needless to memorize, it's listed for convenience.
All based on memory layout reasoning. (plus linking logics)
Break ABI changes:
https://www.acodersjourney.com/20-abi-breaking-changes/
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
https://community.kde.org/Policies/Binary_Compatibility_Examples
Each of these items needless to memorize, it's listed for convenience.
All based on memory layout reasoning. (plus linking logics)
Break ABI changes:
- Un-export or remove a class from the shared library
- Un-export or remove a function or method from a class
- Change the signature of any method in the class. This includes
Changing the return type
Changing the order of parameters
Change the access rights ( eg. public to protected)
Removing or adding parameters - Add, remove, or re-order member variables in a class
- Change the type of any member variable in a class
- Change the class hierarchy of the class exposed in shared library:
make the exposed class inherit from a different base class
make the exposed class inherit from additional base classes
remove base class(es) from the exposed class - Change the template arguments (add, remove, re-order) of a templated class
In line with #3 above since changing the template arguments changes the underlying function signatures generated when the template is instantiated - Inline a function in an exported class
When a function is declared inlined, the compiler inlines it where the function is called and may not generate an out-of-line copy. The client binary, which was thus far depending on the exported out-of-line function signature cannot locate it and will fail in unexpected ways (crash most likely). - Change the const or volatile qualifier of a member function
Some compilers encode the const-ness of a function in the mangled name and hence changing the function from const to non-const changes the mangled name. - Change the type of global data
- Changing the const or volatile qualifiers on global data
- Adding an explicit copy constructor or destructor to a class that would otherwise have implicit versions.
Reference: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html - Changing a non-virtual method to be virtual, and vice versa.
- Adding a virtual method to a class with no existing virtual methods.
- Changing the order of virtual methods.
- Adding new virtual methods (some compilers may preserve binary compatibility if you only add new virtual methods after existing ones).
- Override a virtual that doesn't come from a primary base
- Remove a virtual function, even if it is a reimplementation of a virtual function from the base class
- Change the calling convention of an exported function ( from _stdcall to _cdecl and vice versa)
- If passing C++ types across shared library boundary, make sure that your client binary and shared library are compiled with the same version of the compiler.
ABI remains with these changes:
- Add new class to the shared library
- Add new free functions
- Add new non-virtual method to an existing class
- Add new static variables to a class
- Remove private static variable
(if never referenced from an inline method) - Remove non-virtual private method (if never called from an inline method)
- Change the implementation of an inline method
- Change an inline method to non-inline
- Adding new constructors to the class
- Add a new enum to a class
- Append new enum values to an existing enum class
- Change the default arguments of a method
- Add or remove friend declarations from a class
- Add new static data members
- Extend reserved bit fields, provided this doesn't cause the bit field to cross the boundary of its underlying type
(8 bits for char & bool, 16 bits for short, 32 bits for int, etc.)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.