Course info
Jul 30, 2015
2h 41m

This course will help you understand how the class-based component abstraction presented by Windows Runtime language projections is actually implemented in terms of traditional COM interfaces. You will learn all about the tools and compilers that are necessary to build rich components entirely with Standard C++ in the most efficient manner. You will discover how abstractions like constructors and static methods are implemented with activation factories. You will learn how delegates and events are actually implemented with COM interfaces and lock-free algorithms. And you will discover the weird and wonderful way that the Windows Runtime uses C++ templates to simulate CLR generics using parameterized interfaces.

About the author
About the author

Kenny Kerr is a computer programmer and recognized expert in Windows operating system development and programming languages.

More from the author
SQLite with Modern C++
2h 33m
Feb 18, 2015
The Essentials of the Windows Runtime
2h 48m
Sep 2, 2014
More courses by Kenny Kerr
Section Introduction Transcripts
Section Introduction Transcripts

Windows Runtime Components
Welcome back to the Windows Runtime Internals course. In this module I'm going to show you how to build Windows runtime components, without using Visual Studio. We'll use Visual Studio to test the components from a C# app, but we'll use notepad and the command prompt to author and compile the components. The reason I'm doing this is to make sure you understand what's really going on. In later modules of this course, we'll return to Visual Studio as a convenience, but at least by then you'll know what's going on under the covers. First up, I'll show you how to write components with C++/CX. There isn't that much to it, so it's a reasonable place to start. Next I'll provide a tour of component development with standard C++, as this we'll assume the foundation for the rest of the course. The MIDL compiler will be explored for its application as a metadata generator and even a C++ code generator. And you'll discover what MDMerge is and what specific problem it solves.

Constructors and Statics
Welcome back to the Windows Runtime Internals course here on Pluralsight. In this module I'm going to show you how the Windows runtime augments classic COM to allow classes to have something other than just default constructors. In COMs traditional activation model, you could new up a class given a class ID, but that's about it. There was no way to express something like a constructor that took specific construction arguments. So developers usually provided some kind of factory object that would then provide construction methods. This is a common pattern in directx for example, but the Windows runtime has taken that and baked it into the type system. The implementation is actually largely the same, there's still a factory object with methods that allow callers to construct objects with certain arguments. But there is now enough metadata, such that language projections can actually transform that into something that looks like a traditional constructor, in just the same way that the default activation model we explored in the previous module, was projected to appear like a default constructor to the C# app developer. Of course if constructors taking arguments sounds strange to the traditional COM developer, the idea of static methods might sound even stranger. And yet the two are very much the same. Both rely on a class factory to fulfil this special role, let's take a look. And again it's down to metadata to describe this relationship to a language projection. Let's see how this works. But first up, we need to lay some groundwork with Visual Studio.

Delegates and Events
Welcome back to the Windows Runtime Internals course here on Pluralsight, my name is Kenny Kerr. In this module I'm going to show you how the Windows runtime allows you to program with events across application and language boundaries with ease. We'll explore delegates and events, how they're implemented in C++, and how they get projected into C#. As you should expect by now, it's all just COM interfaces under the hood. We'll also take a look at how the Windows runtime facilitates error handling across ABI boundaries. Let's take a look.

Welcome back to the Windows Runtime Internals course here on Pluralsight, my name is Kenny Kerr. In this module I'm going to show you how the Windows runtime supports generic types. Now the terminology here is a bit confusing, they're not technically called generics they are in fact called parameterized interfaces, but they're designed to look like CLR generics even while their implementation is actually closer to that of the C++ template. It's a bit of a paradox since the CLR and C++ don't have anything in common when it comes to their approaches to generic programming. Fortunately the Windows runtime limits generics to a handful of types that are predefined and available to all, so long as you follow some rules. And specifically, generics in the Windows runtime are limited to events and collections for the most part. And yes, I'm going to call them generics, because that's a lot easier than saying parameterized interfaces the whole time. So let's take a look.

And this brings us the end of this advanced level course on the Windows runtime. In this course we discovered the nature of types as they are implemented and projected through the Windows runtime. We've discovered that the Windows runtime isn't just the Windows API or SDK, as many developers seem to think. But it's actually a technology and a set of conventions and governing rules whereby different languages apps and components can interoperate across ABI boundaries. You learned about constructors, how conventions found in classic COM activation has been adopted and refined to support nontrivial construction directly in various programming languages. You discovered how these same techniques are able to power static members on types that would normally sound ludicrous to the classic COM developer. We explored the way that delegates are really implemented as COM objects with transposed arguments. And how events build on this foundation to provide a formal means by which multiple event listeners can be coordinated by a component with a lock free algorithm. Finally we explored the unique, if limited, approach that the Windows runtime provides for generic programming. Something very much like the way that C++ templates behave, but in a way that looks very much like generics to the C# programmer. There are a variety of courses for you to explore here on Pluralsight as you further your knowledge about COM and the Windows runtime, specifically from the perspective of C++. Since only C++ lets you truly understand and harness the power of the Windows runtime and the future of the Windows platform. Thanks for watching Windows runtime internals on Pluralsight. My name is Kenny Kerr and I wish you all the best.