[Issue 21524] New: [internal] Remove extern(C++) from all dmd functions and data structures
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 4 09:18:08 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21524
Issue ID: 21524
Summary: [internal] Remove extern(C++) from all dmd functions
and data structures
Product: D
Version: D2
Hardware: Other
OS: Other
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
DMD's internal API is unstable and very few people remember there are
downstream C++ users of the compiler who rely on the headers being in sync.
There have been arguments over the best way forward to ensure that all
contributors relieve the burden on gdc and ldc maintainers when making changes
to dmd.
As a compromise, one proposal would be to remove all use of extern(C++) from
the Compiler API. In its place would be a single module defining a stable
interface for C++.
No attempt is made here to give any idealised view of what such a stable
interface should look like, but to give one style as an example:
extern(C++) struct DMDType(T)
{
T impl; // pointer
const(char)* toChars() { return impl.toChars(); }
StorageClass storage_class() { return impl.storage_class; }
BEtype* ctype() { return impl.ctype; }
//...
}
Which will also come with helpers to deal with the initial wrapping of AST
nodes from the D types to C++ types.
--
More information about the Digitalmars-d-bugs
mailing list