Recent

Author Topic: I have yet another newbie question on the {$H+} directive  (Read 455 times)

billd

  • Jr. Member
  • **
  • Posts: 51
I have yet another newbie question on the {$H+} directive
« on: August 20, 2023, 09:56:59 pm »
Hello again.

I recall that with Turbo Pascal there was a compiler directive H+ that would allow an extended syntax for calling procedures that were called by other procedures ahead of the compile order.  But {$H+} doesn't seem to work and I get a compiler error.

What am I doing wrong?  (Windows 10, Lazarus 2.2.6, FPC 3.2.2) I am working with the Lazarus IDE, not FPC.
--------------------------------
For example,

Procedure A;

begin
  call procedure B
end;

Procedure B;

begin
  do something
end;

TRon

  • Hero Member
  • *****
  • Posts: 1841
Re: I have yet another newbie question on the {$H+} directive
« Reply #1 on: August 20, 2023, 09:59:04 pm »
I think you meant forward ?

billd

  • Jr. Member
  • **
  • Posts: 51
Re: I have yet another newbie question on the {$H+} directive
« Reply #2 on: August 20, 2023, 11:02:47 pm »
That's exactly it.  So all I need to do is put the word "forward" after the procedure and include the procedure name and var list just below the Program statement? 


dseligo

  • Hero Member
  • *****
  • Posts: 1077
Re: I have yet another newbie question on the {$H+} directive
« Reply #3 on: August 20, 2023, 11:36:55 pm »
That's exactly it.  So all I need to do is put the word "forward" after the procedure and include the procedure name and var list just below the Program statement?

Yes.
In your example:
Code: Pascal  [Select][+][-]
  1. Procedure B; forward;
  2.  
  3. Procedure A;
  4.  
  5. begin
  6.   call procedure B
  7. end;
  8.  
  9. Procedure B;
  10.  
  11. begin
  12.   do something
  13. end;

billd

  • Jr. Member
  • **
  • Posts: 51
Re: I have yet another newbie question on the {$H+} directive
« Reply #4 on: August 21, 2023, 01:55:18 am »
It worked, thanks very much.

 

TinyPortal © 2005-2018