Issue 23820 - Undefined reference to RTInfoImpl
Summary: Undefined reference to RTInfoImpl
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: betterC, dll
Depends on:
Blocks:
 
Reported: 2023-04-03 22:39 UTC by Richard (Rikki) Andrew Cattermole
Modified: 2023-05-27 18:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Richard (Rikki) Andrew Cattermole 2023-04-03 22:39:55 UTC
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"; }());
    }
}
```