Solved

Procedure in other unit

Posted on 2001-06-04
1
247 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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Create a Restore Point In Windows 10 3 102
Working with hours 3 31
LAN or WAN ? 11 58
creating threads in delphi 1 52
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now