Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Procedure in other unit

Posted on 2001-06-04
1
Medium Priority
?
260 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 120 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

Technology Partners: 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 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