Error: circular initialization dependency with module actor

Frank Benoit (keinfarbton) benoit at tionex.removethispart.de
Mon Jan 15 13:19:36 PST 2007


Orgoton schrieb:
> Queue (class) has
> "public Queue AIQ;"
> defined at the end of the module file. This Queue is used on the default
> constructor of Actor (a class). There is no static constructor on Actor. The only
> static thing on Queue is the symbol above. Queue however must store a list of
> Actor's, hence it has an array of Actor. That is a private member of the Queue
> class. Is this the origin of "Error: circular initialization dependency with
> module actor"? Why didn't I have this error with previous versions?

All static ctor in a module have the same effect (module or class).

The message indicates that there is a dependency problem related to
static ctors.

I try to explain what I understand:
Before main is run, an algorithm tries to run all the existing static ctors.
For each module, there is a list of all contained static ctors and a
list of dependencies (the imports).
It goes to the first modules and calls first recursively all modules
that are listed in the dependencies. If it detects a circular
dependency, the error is thrown.

So, if you use other modules that include your modules or changed
imports or you added static ctors, the behaviour can change.

Tip:
If you use static ctors, be careful with you imports.

Can you reproduce, that this behaviour changed between DMD 1.00 the
version before?





More information about the Digitalmars-d mailing list