I found this question:
Why are my units “compiled with a different version” of my own files?
BUT that question is about Delphi, not freepascal.
Also, in Delphi, I find that an answer to that question omits important information:
From Toon Krijthe’s answer: Jan 9, 2009 at 19:52:
Both unit A and B use unit C and unit B uses C. Unit B and C are
compiled and for some reason the source of unit B is not available.
Now Unit C is changed (any change will do and is recompiled) And the
dcu of unit C differs from the unit C used by unit B, so unit B needs
to be recompiled too. But unfortunately, the source is not available
so the compiler gives up.
In Delphi, that answer is only partially correct.
In Delphi, the real rule is like this:
You can change the implementation part of a unit as much as you like, and that alone should never cause this “unit different version” problem (unless there is a bug in Delphi itself – however I am not aware of any such bug, if such even exists).
However, as soon as you change anything in the interface part, it will immediately trigger this error condition, if even one unit without full source available uses this now changed unit.
My question:
What about Freepascal ?
Does Freepascal have exactly the same rule as Delphi does (meaning it is OK to change only the implementation part, but one should NOT change the interface part, especially if it is one of those units that come with the compiler itself) ?
Or does Freepascal have even more strict rule about this than Delphi does, meaning that in Freepascal even a change in the implementation section only could cause problems ?
And finally:
Can I assume that Ultibo follows the same rules as freepascal does, since Ultibo seems to be a special, modified version of Freepascal/Lazarus -combination ?
In Delphi, the behavior is implemented using a compiler-calculated checksum of the interface section. So, as long as the interface section stays the same, no problem at all. But as soon as you make any change to the interface section, the checksum will no longer match, triggering a recompile of any/all units that use this now changed unit.
Unfortunately my experience with Freepascal is minimal compared to my experience with Delphi, so I don’t really know, if Freepascal follows the same logic and rules here that Delphi does.