-betterC and extern(C++) classes

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 02:23:38 PDT 2017

On 10/09/2017 10:03 AM, 9il wrote:
> On Sunday, 10 September 2017 at 08:56:11 UTC, rikki cattermole wrote:
>> On 10/09/2017 9:40 AM, Yuxuan Shui wrote:
>>> I was experimenting with -betterC and found out that C++ classes 
>>> doesn't work. Because the resulting object file needs a symbol 
>>> "_D14TypeInfo_Class6__vtblZ" which is in druntime. I suppose this is 
>>> to support T.classinfo?
>> Nope.
>>> Could we remove T.classinfo and make classes work under -betterC? Or 
>>> is there some other reason preventing this from happening?
>>> Thanks.
>> Definitely not.
>> Classes require vtable's to work. Vtables are generated as part of 
>> TypeInfo. No TypeInfo, no classes, simple to understand.
> No. vtables can be generated without RTTI and we can have both D and C++ 
> classes in betterC mode. It may not be ready now, but it is definitely 
> possible and should be supported.
> Best reagards,
> Ilya

Agreed, but that is a bigger change and would require a bit more of a 
rethink than just a simple 'remove reference to symbol'.

More information about the Digitalmars-d mailing list