1
votes

I have a class which has many static members, but I have added new function in the middle of the header file.

Does this break binary compatibility? Clients need to be recompiled?

EDIT (1): Class has only static functions, no other functions and data members

1
It may, for example if you added a virtual method before a previously defined virtual method. Sounds like the answer may be compiler dependent though, I'm aware of no guarantees when it comes to binary layout of classes when their definition is changed.Joachim Isaksson
Class has only static functions, no other functions and data membersBaplix

1 Answers

4
votes

Your class has no virtual functions, so your new middle function will not change the v-table. Other static members in the class (functions and global variables/data) are invoked by the appropriate symbol name on Linux, Unix or Mac and your change is backward compatible.

But it's a breaking change on Windows because all functions are invoked by the ordinal number instead of the name (unless you are using def files to define custom ordinals for functions).

Try the abi-cc tool to automatically check backward binary compatibility of your libraries.