0

I am upgrading a project from Delphi XE3 to Delphi Rio 10.3.3. The project contains a number of fixes to the VCL and RTL units, made by copying units from the Delphi install into a path inside the project and applying modifications. This still appears to work so long as the correct compiler options are specified in the unit, but this does not seem to work for System.Classes.pas, getting the infamous error:

F2051 Unit AAA was compiled with a different version of BBB

Has anybody been able to modify System.Classes.pas for Delphi Rio, and if so which compiler switches did you use? I note from this answer: https://stackoverflow.com/a/24145450/12683559 that this was broken in XE6 but worked again in XE7.

Tony
  • 1
  • 1
  • 1
    What modifications are you making exactly? You should be able to modify a unit's `implementation` at will without regard to compiler flags. NEVER modify a unit's `interface`, though. That leads to versioning problems. The only unit that requires special flags is the `System` unit. – Remy Lebeau Jan 09 '20 at 16:06
  • @RemyLebeau In the case of Classes.pas we have declared a class helper in the interface section for one of the stream classes, as well as minor changes in the implementation section. If I remove the changes in the interface section it still fails to compile with the same error. Changes in the interface section seem to work in other units, but perhaps this could cause problems I am unaware of. – Tony Jan 09 '20 at 16:14
  • 1
    @Tony Well, since a class helper modifies the units interface, you cannot do that... – R. Hoek Jan 09 '20 at 17:13
  • @R.Hoek The problem doesn't seem to be related to the changes made, you can drop a clean copy of Classes.pas into a fresh project and it will not build. It could be that this isn't possible with Rio, in which case I will have to change our modifications. Clearly the class helper could be in its own unit anyway. – Tony Jan 09 '20 at 17:28
  • 7
    @Tony, when adding RTL/VCL/FMX units to your project for the purpose of modifying them, you can NEVER modify the `interface` section - period. That is just not allowed. ONLY the `implementation` can be modified. There shouldn't be a problem with `Classes.pas`, so if the compiler won't accept it, that is likely a regression bug that needs to be reported. Or maybe Embarcadero added new requirements in recent versions that are not currently well known yet. Who knows. That being said, there is no need to add class helpers to Embarcadero's units, they belong in your own units instead. – Remy Lebeau Jan 09 '20 at 20:21
  • Yes, have heavily modified classes etc without issue - interface and implementation. The only issue being is that none of the changes can be applied to the design time environment - have not found that to be too much of an issue. We have different build flags for release vs design time for other dependent units. By the sounds of it you don't have the correct combination of search paths and source paths. We don't use any of the standard dcu's for release compile. – myles May 14 '20 at 10:47

0 Answers0