www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18321] New: undefined reference to __ModuleInfoZ depending on

https://issues.dlang.org/show_bug.cgi?id=18321

          Issue ID: 18321
           Summary: undefined reference to __ModuleInfoZ depending on
                    whether module is imported directly or indirectly
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

dmd -oftest3 -version=B main.d
#ok

dmd -oftest3 -version=A main.d
Undefined symbols for architecture x86_64:
  "_D4foo24util12__ModuleInfoZ", referenced from:
      _D4main12__ModuleInfoZ in test3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


```d
module main;
version(A) import foo2.util;
version(B) import foo2.util2;
void main(){fun;}

module foo2.util2;
public import foo2.util;

module foo2.util;
 void fun()(){
   // these cause the link error
   import std.path;
   //import std.file;

   /+
   // these are ok
   import std.stdio;
   import std.range;
   import std.algorithm;
   +/

 }

```

--
Jan 27