Compiling phobos with -cov

kris foo at bar.com
Mon Jun 26 09:36:31 PDT 2006


BCS wrote:
> Don Clugston wrote:
> 
>> Has anyone had any success in compiling phobos with -cov -unittest?
>> Using DMD 0.161 - Windows, it compiles without warnings, but running 
>> the executable just prints:
>>
>> C:\dmd\src\phobos>dmd -cov -unittest unittest
>> c:\dmd\bin\..\..\dm\bin\link.exe unittest,,,user32+kernel32/noi;
>>
>> C:\dmd\src\phobos>unittest
>> Error: circular initialization dependency with module object
>>
>>
>> Am I doing something wrong?
>> (I copied my phobos.lib into dmd\lib to overwrite the existing one).
> 
> 
> this is (I think) a known issue with dmd and circular imports. -cov adds 
> a static constructor that somehow gets interpreted by the runtime as a 
> link in a circular dependency. Until Walter fixes this (please oh please 
> do this soon!!) the best thing I have considered is building with -cov 
> on one or more modules (but not all) at a time.

-cov adds a static-ctor to each module compiled in that manner (IIRC), 
and thus exposes a runtime issue where any of the relevant modules have 
circular imports.

Probably the only realistic way to fix this is to break the circle.

Don ~ I noticed that the new Win32 headers have a similar dilemma. Where 
large numbers of modules are concerned (e.g. Win32) I've found Dimple to 
be a real help in figuring out where the cycles are.



More information about the Digitalmars-d-learn mailing list