[Issue 22367] New: The __ModuleInfo member spuriously linked for modules compiler with -betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 8 16:41:56 UTC 2021


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: nobody at puremagic.com
          Reporter: andrei at 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.

--


More information about the Digitalmars-d-bugs mailing list