Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

The Windows Runtime Library (WRL)

42 minutes, 42 seconds


Right click “Save as…”

Slides (view online) Zip

What is WRL and how does it help you write Metro Apps? Learn what is involved in consuming and authoring WinRT objects with WRL.

For more information, check out this course on Microsoft Virtual Academy:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • JonJon

    If only COM and C++ would die. No such luck though. We get more of it from Microsoft. And security holes for the foreseeable future.

  • CharlesCharles Welcome Change

    @Jon: That's your opinion. I'd encourage you to watch this presentation and learn about WRL, then post something intelligent here, if you must post anything at all.


  • JonJon

    @Charles While I will admit that I didn't watch the video in it's entirety, I think I saw enough of it to know that it's not something I'm interested in using. Exceptions aren't even allowed? I don't see how this is a step forward. Honestly, I can't understand why there is such a push by Microsoft for people to start coding in C++. If you were already using C++, then fine, I'm sure the improvements are great, but, I seriously doubt developers using .NET are going to jump ship and start programming in the new COM. I guess it all depends on the application. If you are writing standard GUI apps, I don't see what the point is. I would rather see Microsoft focus on making managed languages and .NET more efficient. I thought Microsoft had it right back in 2003 when they were saying that 95% of the UI in Vista was going to be in .NET and that new APIs had to be in managed code. Then they back pedaled and released a hugely bloated OS even without managed code. There has to be a better way than COM. It is really strange how a non-Windows specific apps such as MySQL can install in a matter of seconds and something like SQL Server which presumably heavily uses COM takes forever to install. I know that SQL Server probably has far more features, but, something seems wrong with how Microsoft has been doing things. Also, I think C++ means continued vulnerabilities. Sure, you can write secure code in C++, but, that isn't what happens as is proved every other Tuesday when Microsoft releases new patches.

  • CharlesCharles Welcome Change

    @Jon: COM isn't the problem. C++ isn't the problem. Humans write software and it's humans who make mistakes in implemenation of software that can cause security vulnerabilities when the software executes... Sure, some tools make it easier to make mistakes if you don't have enough experience using them, but you can't blame the saw for removing your finger - it just did what you did with it... It's way too simplistic to blame tools for problems that emerge as a side effect of their misuse.

    WRL is a library tool for C++ developers who want to author C++ components for WinRT using a familiar ATL-like development pattern. I encourage you to watch this video if you are a C++ developer (it doesn't seem as though you are...).

    I don't really want to have this debate on this thread... Perhaps we could move it to the Coffeehouse forum. This thread is to be about WRL.


  • JonJon

    @Charles Thanks. I'm in the process of watching Herb Sutter's video on Windows Runtime. He said he recommends using C++/CX instead of WRL. It seems like it might be less horrible.

  • CharlesCharles Welcome Change

    @Jon: Yes. By all means, use C++/CX to consume and author WinRT components in a C++ Metro style application. That's the idea. Herb will explain this in the keynote (good for you for watching it - you should have started there... Smiley ). WRL is an advanced topic. Typically, you won't have to use WRL directly. It's for experienced C++ developers who really understand COM and need to program at the ABI level (this talk explains when you'd want to use WRL, of course, and when you wouldn't)...

    Watch all of the sessions, if you can. You'll have many of your questions and assumptions addressed. 


  • ChrisChris

    Hey Charles, I really appreciate all the content that you provide for us! I have watched most of your EtoE series and usually find talks with Eric Meijer the most informative and easiest to digest.

    I would be interested in some of the motivations behind this library. I have used COM a bit and never found it to be an elegant programming paradigm (and the different threading models certainly take time to get used to).

    In particular, it seems very odd that people have decided to go 'back in time' and just ignore a lot of the lessons we have learned about what makes developing code efficient and error free.

    In particular, COM code for one reason or another always seemed to have extremely high levels of repetition and boilerplate, making its efficiency on functionality-per-lines-of-code basis very very bad as well as the possible bugs per line of code rate quite high. In a lot of situations it felt like trying to program a sophisticated application in assembly.

    Would it be possible to get an EtoE--type interview with someone who could perhaps explain some of the motivations behind WRL and perhaps more fundamentally COM and why it is a good idea to continue this practice? It is difficult not to criticize COM and WRL because they just feel so clumsy.

    Thanks a lot for your work and your willingness to explore and produce so much spectacular content!!


  • @Chris

    My understanding of it is that WRL is a handy way to bring legacy COM libraries forward to be used in Metro style apps without needing to rewrite them completely. It's also a way for people whose companies forbid the use of exceptions (I personally don't know why people do this, but there are places that do it and I'm sure they have their reasons) to write new Metro style libraries and apps without violating their company's internal policies.

    As far as motivations behind COM and the Windows Runtime (and WRL, which is basically a very thin layer on top of WinRT itself), the core purpose is to be able to write some code in whatever language you personally prefer and then let others use it from whatever languages they prefer. I can write a WinRT component in C++, C#, or VB that someone can then use in a Metro style app written in C++, C#, VB, or JavaScript without needing to do anything special. In fact, unless they specifically looked into it, they wouldn't have any idea what language my component was written in. The WinMD metadata file makes it just work (without any interop code) and so now my library is easily available to many more developers than it was before.

    C++ developers should default to using C++/CX to write WinRT components and Metro style apps. The reason for that is that, as you pointed out, WRL (like COM) has a lot of repetition and boilerplate code. But there are those situations where some people will want/need to avoid C++/CX (whether for portability reasons or for exception avoidance or whatever) and in those cases there's WRL.

  • AndyBAndyB

    "Exceptions aren't even allowed? I don't see how this is a step forward." - you realise this is partly designed to be called from C code and similar that do not support exceptions.

    "Honestly, I can't understand why there is such a push by Microsoft for people to start coding in C++."

    Because C++ is a lot more efficient than .NET, Herb Sutter told us that Microsoft's analysis showed the majority of dtaacentre costs is power, and on mobile power (ie battery) is very important. .NET failed to give us very efficient systems, being designed for massively powerful desktop systems with more RAM and CPU than could be consumed by a single user. When you have a million users accessing a cloud service, you do not want .NET to suck up all the resources. This is why C++ is back in fashion.

    "I seriously doubt developers using .NET are going to jump ship and start programming in the new COM"

    Too bad, .NET is already legacy, your new C# and VB.NET apps will have to use WinRT, albeit via a thin wrapper.

  • CharlesCharles Welcome Change

    @Chris: Thanks for the kind words, Chris. In terms of COM/WRL C9 conversations, have you watched these? ->



    I'll try to see if we can get Erik to interrogate (in a nice way) somebody who actively maintains COM in the Windows division. No promises, though. Erik really likes COM, by the way (at least in principle).


  • CharlesCharles Welcome Change

    @AndyB:  .NET is not legacy... Just as C++ and JS aren't.


  • felix9felix9 the cat that walked by itself

    , Charles wroteI'll try to see if we can get Erik to interrogate (in a nice way) somebody who actively maintains COM in the Windows division. No promises, though. Erik really likes COM, by the way (at least in principle).


    Getting people from WinDiv to talk, huh, yeah..... so MoCom is a WinDiv thing.

  • CharlesCharles Welcome Change

    Just added a zip file containing the code used in the demos in this session. Thank you Lukasz and Sridhar!!!!


Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.