locked
WinRT C++/CX support for standart C++ codes

    Question

  • We are getting hard time with WinRT C++/CX.

    We want to make a WinRT C++ project into a C# Win8 Store Project. Those two project will be our solution.

    • But only ref classes allowed in C# if we pass them from C++.
    • Also a ref class should be sealed or inherits a non-sealed class like DependencyObject.
    • if we want to define a variable in it "a non-value type cannot have any public data members" we should add property tag before it.
    • The worst thing is "an unsealed ref class cannot have a public visible constructor. Seal the class, or specify constructor as 'internal', 'protected private' or 'private'
      instead." error.

    Those restrictions are not acceptable. This means we can start a new project in c++ but our old standart C++ codes won't work. This is not a good C++ support, if there were no C++ support would be better and honest I think.

    Any one can help about this. Is there any way to support old C++ codes in Windows 8 Store or Phone Solutions?




    Oğuz Köroğlu
    http://oguzkoroglu.net

    Thursday, October 4, 2012 8:55 PM

Answers

  • Solving with a wrapper will be not a good solution to us because or C++ library also uses and includes the "pthread.h". The old time multithreading from C than we should manage that too. Writing it in C# with Framework's models and Namespaces is better than a wrapper.



    Oğuz Köroğlu
    http://oguzkoroglu.net

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:42 AM
    Friday, October 5, 2012 8:49 AM

All replies

  • You can write a WinRT C++ wrapper along with old C++.

    Charlie Chang L

    Friday, October 5, 2012 2:00 AM
  • Yes, you should write a Windows Runtime wrapper. Meanwhile you can use native class as private, if you do not set native class type as public, it can build well.

    In addition these CRT function cannot be used in Windows runtime library.
    http://msdn.microsoft.com/en-us/library/hh674596(v=vs.110).aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 5, 2012 7:46 AM
  • Thanks Charlie, it is nice idea but this is the same thing writing every thing in C# again. C# wrapper suits us is better than a WinRT Wrapper.



    Oğuz Köroğlu
    http://oguzkoroglu.net

    Friday, October 5, 2012 8:47 AM
  • Solving with a wrapper will be not a good solution to us because or C++ library also uses and includes the "pthread.h". The old time multithreading from C than we should manage that too. Writing it in C# with Framework's models and Namespaces is better than a wrapper.



    Oğuz Köroğlu
    http://oguzkoroglu.net

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:42 AM
    Friday, October 5, 2012 8:49 AM