Bug 23315 – Interface requires vtbl symbol betterC COM

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2022-08-30T17:56:51Z
Last change time
2022-08-30T18:41:21Z
Assigned to
No Owner
Creator
Richard Cattermole

Comments

Comment #0 by alphaglosined — 2022-08-30T17:56:51Z
This came up due to somebody on Discord trying to use COM classes. ```d interface Foo { } ``` Will result in a linker error: ``testcombetterc.obj : error LNK2001: unresolved external symbol __D14TypeInfo_Class6__vtblZ``. Command: ``dmd -betterC file.d`` This works with LDC and is how a COM interface is specified.
Comment #1 by snarwin+bugzilla — 2022-08-30T18:25:39Z
According to the language spec [1]: > A COM interface is defined as one that derives from the interface core.stdc.win­dows.com.IUnknown. So, the example given in this issue is not a COM interface, and therefore should not be expected to work in BetterC (even if LDC allows it as a language extension). [1] https://dlang.org/spec/interface.html#com-interfaces
Comment #2 by alphaglosined — 2022-08-30T18:41:21Z
Okay, so we are dealing with a bad example rather than bad implementation. https://issues.dlang.org/show_bug.cgi?id=23316