[Issue 24882] New: COM class is allocated using GC not malloc
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 26 01:58:43 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24882
Issue ID: 24882
Summary: COM class is allocated using GC not malloc
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: alphaglosined at gmail.com
When ``_d_newclassT`` was templified, the COM support was regressed.
Previously it would allocate using malloc, now it allocates using the GC.
https://github.com/dlang/dmd/blob/f1adbd18a2fe262ee7474193383ea579f09e794e/druntime/src/core/lifetime.d#L2742
The reason for this regression is the gate for determining if a class is a COM
class. Previously it used the TypeInfo flag.
https://github.com/dlang/dmd/blob/1317ba12e242c1fffa76d1cb5e1a405745f89021/druntime/src/rt/lifetime.d#L92
COM classes have the linkage D, but are actually C++ classes in ABI. Due to
this they cannot be checked by the linkage, and changing this would either
result in a lie, or not be a useful distinction here.
My suggestion is to add a new trait ``isCOMClass``, it needs to read the field
``com`` and return that from the class declaration.
--
More information about the Digitalmars-d-bugs
mailing list