I made some changes to a shared library on a linux platform and sent the updated library to the end user. The end user has reported that they believe the binary compatibility has been broken (not really sure how they know that).
The changes I made were to internal classes (user doesn't have the header files):
I made 3 different changes:
- added a protected static member variable to a class (didn't really need to be protected)
- added a private static member to a class
- added a static variable to a cpp file (in a non-anonymous namespace)
Which of these changes (if any) can break binary compatibility and how should I add a static variable so that it does not break binary compatibility? Or is adding a static variable generally safe for preserving binary compatibility?
Example of the change I made (denoted by +
)
internal .h file:
class A
{
protected:
+ static Mutex m;
}
internal cpp file
void A::doSomething
{
+ m.Lock();
...
+ m.Unlock();
}