Solved

Prevent Circular unit reference

Posted on 2006-07-10
5
295 Views
Last Modified: 2010-04-05
How do I prevent Circular unit reference to 'MyUnitU' ?
0
Comment
Question by:crystyan
[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
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
atul_parmar earned 250 total points
ID: 17072448
move either units from interface section to implementation section.
e.g.

interface
uses MyUnitU -->>> Move from here

implementation
uses MyUnitU  ->>> to here
0
 

Author Comment

by:crystyan
ID: 17072465
then how do I declare a variable that is defined in MyUnitU ?
0
 
LVL 10

Expert Comment

by:atul_parmar
ID: 17072504
Moving a unit from interface section to implementation section doesn't affect any other code. you can define /use variables the same way.

Can you clarify what exactly you want to do?
0
 

Author Comment

by:crystyan
ID: 17072514
I have the main unit, then I`m creating a class where I want to declare a variable of a type that is defined in the main unit. or let`s say use a constant from the main unit.
0
 
LVL 10

Expert Comment

by:atul_parmar
ID: 17072548
unit MainUnit

const
  MyConst = 1000;


unit MySubUnit

interface
  procedure MyProc;

implementation
procedure MyProc;
MyVar : Integer;
begin
  MyVar := MyConst;
 
end;
 
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

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 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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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