Solved

Procedure in other unit

Posted on 2001-06-04
1
255 Views
Last Modified: 2010-04-06
Hi I added a new unit (unit2), made there a procedure and tried to use it in unit1, to do so I added in unit one: uses unit2;
and unit2:
uses unit1;
Then I added in unit one in the interface the header of the procedure, but then Delphi always shows a mistake.
Any suggestions?
:)dluedi
0
Comment
Question by:dluedi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
fva earned 30 total points
ID: 6153452
The proper way to do it would be:

unit Unit1;

interface


implementation

uses Unit2;

...
{use proc Proc2 from unit Unit2}
Proc2;
...

end.

unit Unit2;

interface

procedure Proc2;

implementation

procedure Proc2;
begin
  {do whatever here}
end;

end.

You do not have to specify "uses Unit1" in Unit2 unless you need Unit1 for some purpose in Unit2. If so, then take care that only one of the units is referring the other one in the interface part (the other one has to reffer the first in the implementation part to avoid a loop).

If you knew all this, please forgive me for the detail and post some more detail on your particular problem.

HTH,
F.

0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month3 days, 23 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question