Solved

Procedure in other unit

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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