A development tip series for Windows 8 would not be off to a great start without an introduction to the foundation all Windows Store apps are built on. The Windows Runtime, or WinRT for short, is this foundation. WinRT is probably best described as an unmanaged, native API that can be leveraged from many different languages via a mechanism called language projection. Read more to find out some more details about how WinRT works.
(Previous tips can be found here.)
How does this thing work? (in a nutshell)
Since WinRT is designed to be a native API, it can’t contain metadata directly in its code. To get around this limitation, WinRT stores its metadata in .winmd files that are encoded using the ECMA 335 metadata format (CLI). You might recognize this strategy if you’re a .NET developer since this is what .NET does. This enables things like reflection in WinRT.
Object-oriented type system
Built on the metadata system is an object-oriented type system. In this type system can be found a lot of things that could be found in the .NET framework. There are also some new additions. I won’t go into details of what is or isn’t in the WinRT APIs in this post as a) there are a lot and b) I'll probably have tips on these individually later in the series.
Any class that is built to target WinRT is called a WinRT component. Any WinRT supported language can be used to write a WinRT component. Since it is built upon the metadata structure, a WinRT component written in one language can be easily used from another language.
What languages are supported?
For more information on WinRT, check out the API reference for Windows Store apps over on MSDN. Most of the material in this post comes from my original post on this subject over at CodeSnack. There are also several more in-depth discussions about WinRT that can be found by searching for the term in your favorite search engine.
Try it out!
The best way to get a feel for working with WinRT is to just try it out. You can visit the Developer downloads for programming Windows Store apps page where you can get Windows 8 and the tools and SDK necessary to get up and running. You'll need to choose whether you want to develop using XAML or HTML, but I can help you with that decision. Once you're up and running, feel free to check out our Windows UI controls which come with source code for a fully-built application to help you get started.
If you have any questions or comments, please comment below or find me on Twitter @brentschooley. You can also email me at firstname.lastname@example.org.