[Issue 22651] New: undefined reference to ModuleInfo when using imported

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 4 17:27:57 UTC 2022


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

          Issue ID: 22651
           Summary: undefined reference to ModuleInfo when using imported
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: tim.dlang at t-online.de

Compiling the following files with dmd nightly results in a linker error:

///////////////////// a.d /////////////////////
import c;
import std;

imported!q{b}.C obj;

void main()
{
    Appender!string appender;
    std.file.write("test.txt", appender.data);
}
///////////////////// b.d /////////////////////
import c;
class C
{
}
///////////////////// c.d /////////////////////
import std;
///////////////////////////////////////////////

Compiling it with dmd a.d b.d c.d produces the following output:
/usr/bin/ld: a.o:(.data.rel.ro+0x50): undefined reference to
`_D3std8internal6memory12__ModuleInfoZ'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

The error goes away if a custom definition of imported is used.

dmd nightly has to be used, because imported is not available with dmd 2.098.1.

--


More information about the Digitalmars-d-bugs mailing list