The Wiert Corner – irregular stream of stuff

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

  • My work

  • 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 1,811 other followers

Delphi 2007: reproduction and workaround for “[DCC Error] ….pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0”

Posted by jpluimers on 2012/07/31

Just in case you come accross this error (QC 108189):

[DCC Error] CompilerAVUnit.pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0

I had this error in a really complicated unit that I tried to backport from Delphi XE2 to Delphi 2007 (as there was some non-unicode compliant app that needed this).

I could not find it searching for F2084 Internal Error, so I sat down and trimmed it down to the CompilerAVUnit below.

The workaround is simple: remove the static; from method Outer and it compiles fine.

I will post more details on the static keyword in Delphi in a future blog post. For now I’ll keep it at this:

The reason I needed the static is that I had a class property, and the method Outer was in fact a function.

That is easy to workaround too have the property use a static getter which calls the non-static Outer.

type
  TMethod = function: Integer of object;
  TmsxmlFactory = class(TObject)
    class function Outer: Integer; // static; // remove "static;" and the AV goes away
    class function ClassMethod: Integer;
    class procedure CallClassMethod(const Method: TMethod);
    class function GetValue: Integer; static;
    class property Value: Integer read Outer;
  end;

class function TmsxmlFactory.GetValue: Integer; // non static
begin
  Result := Outer;
end;

–jeroen

unit CompilerAVUnit;

{
Reproduction for:
[DCC Error] CompilerAVUnit.pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0
}

interface

type
  TMethod = procedure of object;
  TmsxmlFactory = class(TObject)
    class procedure Outer; static; // remove "static;" and the AV goes away
    class procedure ClassMethod;
    class procedure CallClassMethod(const Method: TMethod);
  end;

implementation

class procedure TmsxmlFactory.Outer;
var
  Value: TMethod;
begin
  Value := ClassMethod;
  CallClassMethod(Value);
end;

class procedure TmsxmlFactory.ClassMethod;
begin
end;

class procedure TmsxmlFactory.CallClassMethod(const Method: TMethod);
begin
end;

end.

8 Responses to “Delphi 2007: reproduction and workaround for “[DCC Error] ….pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0””

  1. Cool, I found your blog. You’re the guy who gave a presentation at CodeRage and your accent makes you sound like the guy in the movie Gold Member. I really enjoyed your presentation. Thx.

    • jpluimers said

      You are most welcome (:
      Which of the guys from Gold Member do I sound like? Austin Powers? If so, that’d be a blast!
      –jeroen

  2. Evgeny said

    Delete all .dcu files. I had the same problem when migrated the project from XE to XE2.

  3. I’ll check later if this is a known issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: