https://issues.dlang.org/show_bug.cgi?id=22367
Issue ID: 22367 Summary: The __ModuleInfo member spuriously linked for modules compiler with -betterC Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: and...@erdani.com This matter has been tenuously discovered by Rikki Cattermole with the help of several other folks in the community during work on https://github.com/dlang/dmd/pull/12832/. Under certain conditions, not readily reproducible in the small, importing a module XYZ that is separately-compiled with `-betterC` causes a linker error caused by the absence of a symbol called __ModuleInfo that is supposed to be defined by the XYZ module. One remedy is to define this inside XYZ: extern(C) __gshared ModuleInfo _D3dmd7backend7ptrntab12__ModuleInfoZ; The apparent reason is that importing a module adds in turn references to all imported modules, see the definition of the importedModules property defined in .object.ModuleInfo. --