RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2191: EXPORTS allowed only at global scope (Delphi)

An EXPORTS clause has been encountered in the program source at a non-global scope.

program Produce;

  procedure ExportedProcedure;
  exports ExportedProcedure;
  begin
  end;

begin
end.

It is not allowed to have an EXPORTS clause anywhere but a global scope.

program Solve;

  procedure ExportedProcedure;
  begin
  end;

exports ExportedProcedure;
begin
end.

The solution is to ensure that your EXPORTS clause is at a global scope and textually follows all procedures named in the clause. As a general rule, EXPORTS clauses are best placed right before the source file's initialization code.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!