Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

Prevent Circular unit reference

How do I prevent Circular unit reference to 'MyUnitU' ?
0
crystyan
Asked:
crystyan
  • 3
  • 2
1 Solution
 
atul_parmarCommented:
move either units from interface section to implementation section.
e.g.

interface
uses MyUnitU -->>> Move from here

implementation
uses MyUnitU  ->>> to here
0
 
crystyanAuthor Commented:
then how do I declare a variable that is defined in MyUnitU ?
0
 
atul_parmarCommented:
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
 
crystyanAuthor Commented:
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
 
atul_parmarCommented:
unit MainUnit

const
  MyConst = 1000;


unit MySubUnit

interface
  procedure MyProc;

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now