C++/CX: How it differs from Native C++/11, does it use the CLR?

So is the CLR still used?

Only if you want to.  So for C# to C++ movers (like me, sort of) you will likely want to do so.  There could be long term issues, so you will want to optimize the use of the CLR which is also referred to as the CLI.

You can use the CLR, if you choose, but you don’t have to use the CLR with C++/CX.  With respect to C++/11, you can easily reuse your experience with C++ in C++/CX.  C++/CX generates native code not the hybrid code that C++/CLI does.

What is this WRL thing?

Windows Runtime C++ Template Library (so why isn’t it WRCTL?)  is discussed in depth at:

So do you use WRL with C++/CX or not?  Not. 

C++/CX is a higher level approach and WRL is a lower level library.  From the link:

  • WRL adds little abstraction over the Windows Runtime Application Binary Interface (ABI), giving you the ability to control the underlying code to better create or consume Windows Runtime APIs.

    • My note: The WRL is similar to the ATL we all know and love, and includes the ComPtr and you would use it like WRL::ComPtr.

  • C++/CX represents COM HRESULT values as exceptions. If you’ve inherited a code base that uses COM, or one that doesn’t use exceptions, you might find that the WRL is a more natural way to work with the Windows Runtime because you don't have to use exceptions.

    • My note: C++/CX has the symbol: ^, which is referred to as the hat, but you might know it as a carat.  The hat ^ has similar behavior but not implementation to the shared_ptr .


WRL is sometimes indicated as similar to C++/CX, it isn’t.  WRL is more like ATL and C++/CX is used to function with COM and WinRT.

Comments (0)

Skip to main content