Retep Retep

Niner since 2011


  • GoingNative Live at BUILD: Herb Sutter, Joanna Mason, Tony Goodhew

    I am not COM expert but to consume WinRT components I am sure you can automatically generate C++ wrapper classes for your COM interfaces. All these COM dirty things like HRESULTS, interface inheritance and COM static methods would be hidden behind clean and easy to use C++ classes. Why we don't have this? I want somebody competent to comment on this.

    The #import directive supported by MSVC compilers for well over a decade does exactly that for COM components. It generates a quite easy to use C++/COM binding for a COM component. It generates smart pointers for the interfaces (no more messing with AddRef/Release), throws exceptions on bad HRESULTs, makes accessing properties as easy as accessing member of a struct, and takes a way a lot of the pain of dealing with BSTRs and variants. It makes dealing with COM from a C++ programmer perspective quite natural and painless. I really wonder why Microsoft opted for creating yet another C++ dialect.