April 03, 2023
https://issues.dlang.org/show_bug.cgi?id=23820

          Issue ID: 23820
           Summary: Undefined reference to RTInfoImpl
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: alphaglosined@gmail.com

This is an issue that I've had for a while that only occurs within dmd as of 2.102.0, works in ldc.

Scenario: -betterC DLL, full D executable.

Results in missing symbols during the executable linking such as: _D6object__T10RTInfoImplVAmA2i96i1063ZQBayG2m

>From what I can tell, dmd is emitting RTInfo at the type being compiled. Which
of course may not exist. In this scenario and it would be better to initialize the template and emit it when required instead.

The workaround for this at the user side (full D executable) is to create
stubs:

```d
version (DigitalMars) version = NeedStubs;

version (NeedStubs) {
    static foreach (Stub; [
        "_D6object__T10RTInfoImplVAmA2i96i1063ZQBayG2m",
        "_D6object__T10RTInfoImplVAmA2i136i87079ZQBcyG2m",
        "_D6object__T10RTInfoImplVAmA2i208i3560789ZQBeyG2m",
        "_D6object__T10RTInfoImplVAmA2i56i66ZQyyG2m",
        "_D6object__T10RTInfoImplVAmA2i264i6098517954ZQBhyG2m",
        "_D6object__T10RTInfoImplVAmA2i168i349524ZQBdyG2m",
        "_D6object__T10RTInfoImplVAmA2i152i305834ZQBdyG2m",
    ]) {
        mixin(() { return "extern(C) void " ~ Stub ~ "() { asm { naked; dl 0;
dl 0;}\n}\n"; }());
    }
}
```

--