Search code examples
delphidelphi-xe7runtime-packages

XE7 link runtime package issue


I am moving my code from Delphi 2007 to XE7. My program use late binding package way. So I compile my application with "link with runtime packages" options. I used this way for a long time with 2007.

But in XE7, same package structure, cause:

"Unit X was compiled with different version of Y.Txyz" error message.

Unit X in one of my package. Y unit is in a library package also. Relation seems ok. Why XE7 gives this error? I tried following ways:

  • I cleared .dcu files.
  • I open Build as Needed option in packages.
  • Build All every package and application files.

Compiler pass some errors but repeat ".. compiled with different version .." type error somewhere else..

I am not clear about this issue. Is there changing in logic of XE7? Best Regards


Solution

  • I focused on the problem and I realised some differencies XE7 from Delphi2007.

    • Compiler search for *.dcu files. If there is more than one version of *.dcu files produced somehow, than one of the package can produce "unit compiled with different version" error.

    • If source package declared as "Rebuild as Needed", when compilingg other packages using source package, compile units again and produce new dcu files. So, Instead, check "Explicit Rebuild".

    • I created common dcu path and declared in "unit output directory" for all packages.