www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22367] New: The __ModuleInfo member spuriously linked for


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

This matter has been tenuously discovered by Rikki Cattermole with the help of
several other folks in the community during work on

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

Oct 08 2021