locked
Calling AMP from within C# Metro app. RRS feed

  • Question

  • Hello all.

     

    I saw Daniel Moth's talk at BUILD and was very impressed. I was delighted to learn that I can use AMP from a Metro app. However, it's been many years since I've done any C++ coding and I think the path of least resistance for me would be to code my Metro app in C#/XAML and make calls to AMP via P/Invoke. Traditionally I believe this is done via a C++ DLL that contains the functionality and then a P/Invoke call into that DLL from your C# code. Is this the same approach for Metro apps? I will be passing only 1D arrays of primitive types from C# (Bytes, Floats, Bools).

    Lastly, could someone point me to a little tutorial that illustrates this P/Invoke approach? Thank you in advance.

    Sunday, September 18, 2011 2:57 PM

Answers

All replies

  • You still need to write some C++ code: C++ AMP algorithm itself and a thin wrapper to get your data in and out. There is a new better way than P/Invoke of interop between C++ and C# - use WinRT types. See "Using the Windows Runtime from C++" TOOL-532T_Sutter BUILD presentation for an overview.

    • Edited by pauljurczak Sunday, September 18, 2011 4:09 PM
    Sunday, September 18, 2011 3:38 PM
  • Hi LKeene,

    We just posted a tutorial and a sample on how to use C++ AMP from C# using P/Invoke: http://blogs.msdn.com/b/pfxteam/archive/2011/09/21/10214538.aspx

    In the upcoming days, we also plan to post an article on how to use the new WinRT approach to invoke C++ AMP code from C#.

    Igor

    Wednesday, September 21, 2011 10:31 PM
  • Thank you for both replys. This is great Igor! I'm particularly interested in calling C++ amp from C# + WinRT, so I'll definately be on the lookout for that article.

    LKeene

    Friday, September 23, 2011 2:37 PM
  • Hi,

    was the article on the WinRT approach to invoking C++ AMP code from C# ever posted? Thanks.

     

    -L

    Friday, November 18, 2011 4:41 PM
  • Yes it was:

    http://blogs.msdn.com/b/pfxteam/archive/2011/11/12/10236375.aspx

     

    Cheers

    Daniel

    PS. Please mark responses as answers if you think they are.


    http://www.danielmoth.com/Blog/
    • Marked as answer by LKeene Wednesday, December 7, 2011 9:22 PM
    Friday, December 2, 2011 3:39 AM
  • Great! Thank you for this, guys. -L
    Wednesday, December 7, 2011 9:22 PM