Cyclic dependency error

Mike Parker aldacron at gmail.com
Tue Nov 7 14:33:07 UTC 2017


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 at 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.




More information about the Digitalmars-d-learn mailing list