I’ve the following class definitions in exe and dll.
// A.exe:
Class A { void fun() { B* b = new B(); b.funx(); }
// B.dll:
Class B { void funx (void) { C* y = new C(); y.funy(); }
Class C { void funy() { } }
Lets say I change the size of class B, should i recompile A.exe? And should I recompile A.exe even if I change size of class C?
You have to recompile a.exe every time the public interface of b.dll changes (not only the size, also when members are reordered, private/public changes [this also affect member ordering, without being visible from the source code], …). If
Cis part of the public interface, then you need to recompile A.exe also every time whhnCchanges. You only don’t need to recompile a.exe ifCis a private class of b.dll, which is nowhere referenced from a.exe. Also note thatCcan be indirectly referenced, for example when yourB::funxis an inline function, since then the instantiation of C can take place in tho code of A.exe.As a rue of thumb, when you replace the definition of
Cwith the declarationclass C;, and still can compile A.exe, you don’t need to care aboutC. But I would rather suggest to compile A.exe every time, since when at some point in the future the code changes, so that this condition is not met, you are going to get hard to debug errors.