Sunday, 31 August 2014

Programming at the API Boundary in Windows 8: C++ Component Extensions

The WinRT - What CX is All About

C++/CX (Component Extensions) borrows from C++/CLI but targets the Windows Runtime (WinRT) and native code instead of the CLR and managed code.

It is not Managed C++, though it looks a bit like it.  Neither is it perfectly obedient, standard C++. It is C++ with a bit of "Microsoft spice" added to the fray.

Can thou givest an example of "Microsoft Spice" added to the fray?

Among the so-called "component extensions" is support for partial classes, mainly for auto-merging generated code with developer code. Partial classes are not part of the C++ standard (at least, not as part of C++11).

The entry point - notion of the "ref class"

To use "component extensions" you must declare your class as a "ref class" e.g. public ref class SuperClass. To make it partial, you can whack a partial on the front: partial ref class SuperClass.

C++/CX also supports runtime generics (versus compile-time generics in the STL). However, support for compile time generics remains in place.

No comments: