0

So, people. I have a aparently simple question. Does Delphi consider the next example as a Circular reference? I'm reaching Out of Memory Error with a similar set of code.

unit CodeA;

interface

uses CodeB;

implementation

end.

-

unit CodeB;

interface

uses CodeC;

implementation

end.

-

unit CodeC;

interface

uses CodeA;

implementation

end.
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Guill
  • 350
  • 5
  • 17
  • 1
    Why don't you test it? Add those three files to a new project and try to compile. – Blorgbeard Dec 26 '13 at 19:40
  • I just said I have a similar project. But I'll edit the question... – Guill Dec 26 '13 at 19:46
  • Can you explain what the edit to the question is about. I thought I answered the original question that you asked. – David Heffernan Dec 26 '13 at 20:16
  • Sorry. I totally restrutured the question. I had already concept of Circular Reference. I made a mistake. Better improving the Title. Sorry about your answer. I think i would be better you to delete it. – Guill Dec 26 '13 at 20:18
  • 1
    I don't think so. I suggest that you ask a new question. It's not right to ask a question, receive an answer, and then decide that's not good enough because you asked the wrong question. Chalk it down to experience, and ask the question you really mean to ask. But do take care to ask a clear and precise question. I rolled back this one. – David Heffernan Dec 26 '13 at 20:19
  • There is a way to copy the Question I've edited? I'm sorry anyway. – Guill Dec 26 '13 at 20:23
  • Yes, the revisions are here: http://stackoverflow.com/posts/20790273/revisions Why does GISystem use other units? That appears to be the problem. – David Heffernan Dec 26 '13 at 20:24
  • Because system will contain properties with classes in GICustomClasses and GIGameClasses but I'm not asking again. I think I did solve this one. Anyway, for the question above I guess your answer is proper. I'm accepting it. – Guill Dec 26 '13 at 20:26
  • @Guill Well, if `GISystem` has that, then yes it changes things. But we cannot work that out from the question that you posted. So those sort of details are key and you have to include them when asking. Just for future reference. Thanks for your understanding. – David Heffernan Dec 26 '13 at 20:31
  • 1
    Note that if you move one of the uses statements down into the implementation part, it'll work. Of course, that means you cannot use types from that unit in the interface part of the unit that uses it. – Lasse V. Karlsen Dec 26 '13 at 20:32

1 Answers1

2

The code in the question has a circular reference. That is, a dependency chain that leads from one unit, back to that same unit. It does not matter how long the chain is. In this case its length is three, but it could be any length.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490