-betterC and extern(C++) classes

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 14:42:44 PDT 2017


On 9/10/2017 8:08 AM, Yuxuan Shui wrote:
> By the way, can we dynamic_cast extern(C++) classes in C++?

No. Generally, one would need C++ RTTI for that to work, and that:

1. is specific to the particular C++ compiler
2. is undocumented, half-documented, or wrongly documented
3. requires the C++ runtime library to work

It's certainly possible to do this, but requires time, effort, and a certain 
willingness to deal with the dirty underbelly of undocumented binary formats.

> If not, what are we generating these TypeInfo_Class for?

It has other uses, such as providing info for associative arrays and the garbage 
collector.



More information about the Digitalmars-d mailing list