Can I use pure native C ++ to write applications for Windows 8 metro?

With native C ++, I mean, not managed C ++, not cli, and not any special things from microsoft, I can:

1) get high performance 2) use the existing C ++ code library and engine 3) write cross-platform code (for example, for ios and android)

it doesn't have to be completely native C ++, I can use managed code to do ui things like object-c in ios and java in android, but in addition to the interface, can I use my own C ++ code?

+6
source share
2 answers

I suggest you familiarize yourself with the presentation here: Using Windows Runtime with C ++ and especially on Herb Sutter's comments. I quote:

Please answer this question: if I decide to write a Metro-style C ++ GUI application, am I forced to use all of these proprietary refs, sealed, ^, Platform :: String ^ for GUI components or not?

@ Thomas: No, you are not forced to use them. We provide two supported methods:

1) These language extensions (C ++ / CX).

2) C ++ Template Library (WRL), see Windows Kits \ 8.0 \ Include \ winrt \ wrl, as Yannick mentioned. WRL is a C ++ library-based ATL line option that offers what I think you are looking for - template wrapper / convenience classes and explicit smart pointers, etc.

+7
source

Yes, you absolutely can, real native C ++ is fully supported.

However, as a rule, you have to use the new WinRT libraries to make the user interface or system calls, and although they are internal code and can be directly derived from C ++ directly, the interface makes it very painful for them to do this, since all reference counted is an object and, in addition, it is not so easy to create instances from them, as it is just calling "new" ones, so you need to write a lot of ugly code for this.

As the answer said earlier, microsoft provides two ways to help with this. One through language extensions to C ++, and the other through a C ++ template library. Personally, I believe that both are pretty ugly in order to do something as simple as calling an API, but that's just me :)

But to answer your question, it is quite possible to write your application in real native C ++. You do not need to use managed code at all. But you probably want to use either language extensions or a template library to simplify the API call.

Personally, I hope someone writes a wrapper for WinRT that provides the most necessary functionality as a more usable C ++ native library, and then anyone can just use it from C ++ instead ...

+3
source

All Articles