Solved

Procedure in other unit

Posted on 2001-06-04
1
250 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
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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