locked
C++ interop question

    Question

  • It is possible this question has already been answered, though I could not find the detailed answer.

    1. Can standard C++ code call WinRT library APIs. Win32 calls are also made in this C++ code.

    2. Can standard C++ code be wrapped up with WinRT wrapper to enable calls from WinRT app.


    • Edited by san_200 Friday, March 23, 2012 9:47 PM
    Friday, March 23, 2012 9:45 PM

Answers

  • >This DLL shall also make Win32 calls internally apart from calls to WinRT libraries

    If you call any desktop-only APIs, then any app that uses your dll will fail to publish to Microsoft's store.

    >I want standard C++ code to be wrapped with WinRT Wrapper

    File->New Project->WinRT Component DLL



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    Monday, March 26, 2012 7:26 PM

All replies

  • if your "standard code", mean CRT, it is ported to WinRT, so you are free to use it in WinRT components. If you are calling Win32 APIs directly, then you need to port your code to WinRT, if you are writing a WinRT app. 




    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    Friday, March 23, 2012 10:27 PM
  • Please let me rephrase the question.

    1. I want to have a separate DLL written in C++ that calls WinRT libraries. This DLL shall also make Win32 calls internally apart from calls to WinRT libraries. 

    2. I want standard C++ code to be wrapped with WinRT Wrapper, so that any WinRT app can call this new WinRT library.

    What are the steps that I need to do to achieve the same.

    • Edited by san_200 Monday, March 26, 2012 7:03 PM
    Monday, March 26, 2012 6:36 PM
  • >This DLL shall also make Win32 calls internally apart from calls to WinRT libraries

    If you call any desktop-only APIs, then any app that uses your dll will fail to publish to Microsoft's store.

    >I want standard C++ code to be wrapped with WinRT Wrapper

    File->New Project->WinRT Component DLL



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    Monday, March 26, 2012 7:26 PM