On Sat, 23 Apr 2011 04:34:39 -0400, Jonathan M Davis <jmdavisp...@gmx.com>
wrote:
It happens when a module imports - directly or indirectly - another
module
which imports it - directly or indirectly - and they both have static
constructors and/or static destructors (it _might_ not happen if one of
them
has static constructors but not static destructors and the other has
static
destructors and no static constructors, but if they both have either a
static
constructor or static destructor, it _will_ happen).
Note, the cyclic detection algorithm does not distinguish between these
scenarios. It does distinguish between thread local and shared
ctor/dtors, but it just uses a single flag to denote having static
constructors or destructors.
I think the reason might be that the runtime is supposed to run
destructors in reverse order as constructors. If it did the cycle
detection independently, you would possibly have a different order for
destruction. I'm not sure it really matters. It might be worth a
bugzilla report/further discussion.
-Steve