Home > database >  How to do when procedure A need procedure B and procedure B need procedure A inside a DPR
How to do when procedure A need procedure B and procedure B need procedure A inside a DPR

Time:11-05

Inside a DPR I have

procedure A;
begin
  ...
  B;
  ...
end;

procedure B;
begin
  ...
  A;
  ...
end;

How to handle such case inside a DPR? inside a normal unit it's quite easy I just need to declare both procedures in the interface section of the unit, but inside a dpr how to do as their is no interface section.

CodePudding user response:

You need to use a forward declaration:

procedure B; forward;

procedure A;
begin
  if 1   1 = 3 then
    B;
end;

procedure B;
begin
  if 1   1 = 3 then
    A;
end;

(Of course, forward declarations can also be used in the implementation section of units, so you don't need to pollute the unit's interface just to make two implementation-section routines know of each other.)

  • Related