Class info on interfaces

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 27 23:20:19 PDT 2015


On 2015-08-26 20:59, Adam D. Ruppe wrote:

> Yes, exactly. COM and C++ things won't necessarily have a D TypeInfo
> available and since interfaces can be them, it can't be sure.
>
> What I do there is to just cast the interface to Object. Then you should
> check for null to cover those cases, then you can typeid or classinfo it.

Is it possible to detect at compile time if an interface is not a native 
D interface?

Now when I think about it, we actually have four (!) different kinds of 
interfaces. Native D, C++, Objective-C and COM.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list