EXE and DLL dependency - When to recompile the EXE?
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 C
is part of the public interface, then you need to recompile A.exe also every time whhn C
changes. You only don't need to recompile a.exe if C
is a private class of b.dll, which is nowhere referenced from a.exe. Also note that C
can be indirectly referenced, for example when your B::funx
is 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 C
with the declaration class C;
, and still can compile A.exe, you don't need to care about C
. 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.
You should re-compile if you change size of class B
If size of B does not change by Changing size of class C, you need not to re-compile A.
It seems, B is not inherited from C, so size of B does not change.
--Cheers
精彩评论