-betterC and extern(C++) classes

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 01:56:11 PDT 2017

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?


> 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.

Same reason why you can't use classes and cross the dll boundary on Windows.

But if you prefer not having any methods to call, then I'm sure we can 
remove the requirement on the vtable ;) (Not a solution)

More information about the Digitalmars-d mailing list