The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,152 other subscribers

Archive for March 19th, 2013

Porting Delphi 2006 to XE2, fields versus properties: tightened compiler error E2197

Posted by jpluimers on 2013/03/19

When porting some communications code that used records as properties from Delphi 2006 to Delphi XE2, I came across a tightened compiler error “E2197 Constant object cannot be passed as var parameter“.

Let me first explain the good old occurrence of E2197 with some code that uses my last Variant Records example:

Just look at TPacket.InitializePacket and TPacketBase.InitializeFPacket: Basically even though the Packet property has storage specifiers indicating it directly reads from a field and directly writes to a field, you cannot pass it as a var parameter in the FillChar method.

Of course you can with a field, you can pass it to FillChar without trouble as TPacketBase.InitializeFPacket shows. Read the rest of this entry »

Posted in Delphi, Delphi 2006, Delphi XE2, Delphi XE3, Development, Software Development | 3 Comments »

 
%d bloggers like this: