locked
DLLimport in c++ WinRT

    Question

  • Hi,

    I am porting a c library to c++ WinRT. The above code gives the error 'C2337: 'DllImport' : attribute not found'

    [DllImport("Algorithm.dll")]
    int *TestImport();

    How to import dll in C++/CX?

    Thanks
    Poornima

    Friday, August 31, 2012 10:34 AM

Answers

  • DllImport is part of .Net. If you are using C++/Cx it isn't relevant (you can use it from C#), and you can't use C++/CLI in a Windows Store app.

    You can import DLLs in C++/Cx the same way you would in C++. You can also wrap it in a Windows Runtime Component, in which case you can use it from C# or JavaScript as well.

    --Rob

    Friday, August 31, 2012 6:54 PM
    Owner

All replies

  • you cant use dllimport so you will need to convert the algorithm.dll to a winrt component also.

    Friday, August 31, 2012 11:29 AM
  • Ok in that case I have C++/CLI wrapper around the c dll. How can I use in the winRT project? My goal is to use the C++/CLI dll in a metro app. How do I go about it?

    Friday, August 31, 2012 5:06 PM
  • DllImport is part of .Net. If you are using C++/Cx it isn't relevant (you can use it from C#), and you can't use C++/CLI in a Windows Store app.

    You can import DLLs in C++/Cx the same way you would in C++. You can also wrap it in a Windows Runtime Component, in which case you can use it from C# or JavaScript as well.

    --Rob

    Friday, August 31, 2012 6:54 PM
    Owner