Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:C++ support from Windows Phone 8

From Wiki
Jump to: navigation, search

Contents

Hamishwillee - Review/feedback

Hi Yan

I am not an expert on this topic so I can't assess it properly. On the face of it though you've created a really interesting topic with many great links to other related/useful information. This does need a subedit for English and grammar (which I hope to give it).

Some thing I found hard to understand:

  • This makes no sense: "This API is based on COM-like technology. Like COM is not user-friendly, Microsoft have created Visual C++ Language Reference (C++/CX) to Consume this API with C++ and create WinPRT components. This extension adds to C++ managed concept like garbage collector, properties, delegate, event.... To be consumed by manged code, class developed in C++/Cx generate metadata. "
    • - what do you mean by "Consume". I think you may mean "use" or "link to" - so for example "you can't use a C++ object direclty in your C# app - you need to first write a Windows Runtime layer library".
    • I also think you are mixing COM and CX and also the purpose of the CX - What I THINK you mean is that
      • to write a native extension you need to use the Windows Phone Runtime layer.
      • The extensions allow you to write in "close to modern C++ code" and avoid the complexity of COM.
      • The toolchain does any work needed to output COM metadata for you. - is that correct?
  • You refer a lot to direct3D, but not so much to the other DirectX libraries. Is there anything special that should be said about them?

Regards

Hamish

hamishwillee 08:38, 26 November 2012 (EET)

Yan -

Hi. Thanks a lot for feedback

  • what do you mean by "Consume". I think you may mean "use" or "link to" - so for example "you can't use a C++ object direclty in your C# app - you need to first write a Windows Runtime layer library".
    • Microsoft use Consome in its documentation.
  • to write a native extension you need to use the Windows Phone Runtime layer.
    • Windows Phone Runtime is written in C++/CX. You need a C++/CX layer.
  • The extensions allow you to write in "close to modern C++ code" and avoid the complexity of COM.
    • "close to modern C++ code" : is a point of view ;).
    • WinPRT is not exactly COM Object. It's based on it. For example to access low level of camera API you need to query a COM Object. It's an evolution.
  • The toolchain does any work needed to output COM metadata for you. - is that correct?
    • Maybe better : The toolchain does any work needed to output WinPRT metadata for you.
  • You refer a lot to direct3D, but not so much to the other DirectX libraries. Is there anything special that should be said about them?
    • If i understand correctly, WP8 give access only to Direct3D.

Regards

Yan

yan_ 10:43, 26 November 2012 (EET)

Yan -

I've update this explanation :

This API is based on an evolution of COM technology. To use it with C++ and write easily a WinPRT component, Microsoft have created the Visual C++ Language Reference (C++/CX). This extension adds to C++ managed equivalent like properties, delegate, event.... To be consumed by manged code, class developed with C++/Cx generate metadata. In fact, toolchain translate this class to a complex C++ code with WinPRT annotations :

Is it more comprehensible?

yan_ 14:52, 4 December 2012 (EET)

Hamishwillee - Yes.

Yes this is more comprehensible. I am hoping to go through the article again and make some updates. However currently swamped.

hamishwillee 07:27, 5 December 2012 (EET)

Hamishwillee - Made a few minor updates

Basically fixed a few more minor errors in wiki text and English. This is a complicated topic but I'm finding it more comprehensible on each re-read.

hamishwillee 07:31, 19 December 2012 (EET)

Yan -

Thanks.

yan_ 23:34, 19 December 2012 (EET)

Pham.nguyen - Windows Phone runtime component supported C language ??

i use libresampling but it's in C language, not C++ , can i import libsampling to Windows Phone runtime component ???? and how to compile windows phone runtime component in C ????

pham.nguyen (talk) 07:25, 19 September 2013 (EEST)

Yan -

I thinks it's possible. Normally the c++ compilator can build C sources. So, you could create a winPRT project, add sources and try to build. After you should create a C++/CX interface.

yan_ (talk) 10:19, 19 September 2013 (EEST)

Hamishwillee - Add a note in the article?

Hi Yan

It might be worth adding a small section on C in the article - stating that this is what "should" be possible but that it is untested. Of course a full article would be better :-) Up to you.

regards

Hamish

hamishwillee (talk) 03:25, 20 September 2013 (EEST)

Hamishwillee - Added

Vaishali added a section and I've polished it a bit.

hamishwillee (talk) 04:33, 4 October 2013 (EEST)

Jakkkkk - C++11

Hi Thanks for this very useful article. According to a little test I've made, it looks like the C++ compiler used for building the native code on Windows Phone doesn't support C++11 as far as I can tell. I've tried basic C++11 new language features like defaulted and deleted function, and constructor delegation and they don't compile. (strangely enough, std::shared_ptr seem to be work on Windows Phone though). Have you got any official information about C++11 support for Windows Phone? Thanks a lot

Jacques

jakkkkk (talk) 12:36, 19 November 2013 (EET)

Yan -

Hi. You can look this page : http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx

Defaulted and deleted functions will be supported with Visual 2013

yan_ (talk) 12:44, 19 November 2013 (EET)

Jakkkkk - C++11

Hi Yan, thanks for the reply. I've already consulted the page you mentionned. I should have said that I tried compiling the code with Visual Studio 2013, which is why I'm a bit surprise of the lack of C11 support on Windows Phone (unless I've missed an option somewhere!).

What I've done is simply take an official Windows Phone example that does native C++ (Marble Maze). Then add a small test class that uses C11 features, and noticed that these features were not understood by the compiler which reported them as errors.

Another way of showing the issue is to: - create a Visual Studio 2013 application (a regular Windows one) - add my tiny C11-class - compile and see that it compiles happily. - then simply change the Platform Toolset to "Windows Phone 8 v110" in the projects settings and see that compilation of the same code fails this time.

Let me know if you've got any suggestions Thanks!

Jacques

jakkkkk (talk) 12:58, 19 November 2013 (EET)

Yan -

The minimum is normally the subset supported by Visual 2012. A don't know for visual 2013, it's just a supposition. It's not really cleare. Actually i know these feature works :

  • smart_ptr
  • thread & mutex
  • lambda function
  • override & final

Which feature have you try?

Could you show you tiny C11 class? or give a sample?

yan_ (talk) 14:23, 19 November 2013 (EET)

Jakkkkk - C++11

Here are the features I've tried that don't seem work (smart_ptr and final works as you said, I haven't tried the other ones but I trust you :))

  1. pragma once
  2. include <cmath>

class MyClass1 { public: MyClass1(int new_number) : number(new_number) {} MyClass1() : MyClass1(42) {} // Compilation error

static float myfunc(float f) { return std::round(5.3f); } // Compilation error (std::round not found) private: int number; };

class MyClass2 { public: MyClass2() = default; // Compilation error };

(you'll have to include the header in a cpp to get it compiled).

Seems that the C++ compiler used for Windows Phone is a bit behind its desktop big brother...

jakkkkk (talk) 15:23, 19 November 2013 (EET)

Yan -

I haven't visual 2013 to test. Maybe Visual 2013 use same compilator as visual2012 for WP8. I don't know if you install same SDK with Visual 2013 and visual 2012. So, i thinks, until a new SDK is released, you must look only subset supported by Visual 2012 :

So, everything is normal :p

Visual 2012 have ever a good subset of C++11.

yan_ (talk) 15:41, 19 November 2013 (EET)

Jakkkkk - C++11

I've installed Visual Studio 2013 and the Windows Phone SDK 8.0 that comes with it (an option to check during VS2013 installation). I think that's the most recent version of the SDK see http://social.msdn.microsoft.com/Forums/wpapps/en-US/14165347-7cfc-4d15-b27a-f21d19ebd9d2/is-windows-phone-8-sdk-now-builtin-to-visual-studio-2013-professional-and-premium?forum=wptools

So anyway, I'll work with the limitations in the C11 support, that will be OK :)

Thanks Yan anyway for the help!

jakkkkk (talk) 15:55, 19 November 2013 (EET)

Yan -

Thanks for your feedback.

I've add a note about it

yan_ (talk) 18:34, 19 November 2013 (EET)

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×