Archived

This topic is now archived and is closed to further replies.

Xorcist

Prototyping in Progam not Unit (How to?)

Recommended Posts

Okay I know I can prototype functions and procedures within a unit, using the interface section, such that a routine can call another that is defined below it rather than mandating that it be defined above it. Question is, can I do this in a program, and if so how would I go about doing it. P.S. I know I can declare everything in a unit and just include that unit in my program to gain the functionality I need, but if there is another way to do it I''d appreciate hearing about it, thanks.

Share this post


Link to post
Share on other sites
Hmm? Are you talking about forward declarations?


  
program Project1;

{$APPTYPE CONSOLE}

procedure WriteTheStuff; forward; // forward declaration


procedure UsesNextThing;
begin
WriteTheStuff;
end;

procedure WriteTheStuff;
begin
WriteLn(''blah'');
end;

///////////////////////////////////////////////


begin
UsesNextThing;
end.


?

Share this post


Link to post
Share on other sites
Damnit! No wonder I couldn''t get this to work! I was using "foward" (notice the missing "r" after the "o"). I knew that was the way to do it but since "foward" doesn''t show up in the help, and obviously won''t work, I was totally befuddled as to whether or not Delphi supported it at all. Guess I gotta start reading my dictionary again...

thanks.

Share this post


Link to post
Share on other sites