Visual C++ WinRT FAQ – Alternative to C++/CX

There are C++ developers who haven’t really been thrilled with using the C++/CX extension syntax. It’s alien to C++ in some ways and many people prefer to write code that’s as close to ISO C++ as possible. While you can avoid C++/CX and write staight C++/COM code to consume and create WinRT, it will be an unbelievably painful experience. So on one side you have C++/CX which I consider to be high-level access to WinRT and on the other side you have straight C++/COM which I consider to be low-level/raw access to WinRT.

There is a middle path though. It’s called WRL – Windows Runtime C++ Template Library. Maybe they should have called it WRCTL, but they called it WRL and I’ve heard a few folks pronounce it as “Wurl”. WRL is to WinRT what ATL was to COM. WRL allows you to avoid using the extension syntax and to use ISO C++ to write WinRT components. That said, you’d be kidding yourself if you assume WRL allows you to write portable code. The moment you use WRL, you are locked into WinRT/Metro. So it’s not as if you can take that code and reuse it in your GCC/Linux project.

Which of the two should you choose between C++/CX and WRL? Well, there are a few things to consider there and I’ll cover that in the next blog entry. But eventually it’s a subjective per-project decision that you need to make.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s