On Tuesday, 7 November 2017 at 14:05:41 UTC, Steven Schveighoffer wrote:
On 11/7/17 7:49 AM, Tony wrote:
My program compiled, but when I ran it I got this error message:

object.Error@src/rt/minfo.d(371): Cyclic dependency between module variable and main
variable* ->
misc ->
main* ->
variable*


I take it that the -> represents a dependency from the module on that line, to the module on the line below. My question is what do the asterisks represent?

The asterisks represent modules with module ctors/dtors. So misc is an intermediate step, but has no module ctor/dtor.

A cycle between a module with a ctor and itself is OK, as long as it only goes through such import paths.


See https://dlang.org/spec/module.html#order_of_static_ctor for options on how to handle cycles other than rewriting.


Reply via email to