locked
Use a C++ WinRT Component with external LIB in a C# Universal App

    Question

  • Hello,

    I created two projects : a C++ WinRT Component project and a C# Universal app that references directly the C++ project.

    If I call a method from my class in the C++ Windows Runtime Component project from C# it's working fine.

    I got the following error in the C# Universal App project when I reference an external LIB in the C++ project : "Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)".

    Do I need to reference somehow the LIB (I got a DLL with the LIB too) in the C# project too?

    Thanks,

    Adrien.

    Monday, March 09, 2015 7:00 PM

All replies

  • First of all you need to copy .dll of your external library into output directory of your app. Simply add it to the C# project and change it's "Build Action" property to "Content".

    There is another thing which I need to mark. Your external library needs to be compiled as Windows Runtime library (dll). Otherwise you continue to see error message that the library is not found.

    Monday, March 09, 2015 8:49 PM
  • I don't know how the external lib is compiled.

    I thought it was possible to use a lib in a WinRT component and use the WinRT componenet in C# Universal app...

    Monday, March 09, 2015 10:31 PM
  • Is it possible to create a wrapper in Windows Runtime Library for an existing lib?
    Tuesday, March 10, 2015 3:39 PM
  • Hi Adrien,

    What do you mean by "reference an external LIB in the C++ project", the C++ project you mentioned here is a normal C++ project?

    As I know we have to check the option support in Windows Store App.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 16, 2015 3:23 AM
    Moderator
  • No, the C++ project I refered to is a C++ Windows Runtime Component project. It has automatically the Windows Store App Support to yes (I can't even changed the value).

    I want to use an external library (a library for which I don't have the source code, only the DLL and LIB files) in that WinRT Component project (that is working  I assume). The problem happen when I use my WinRT component project in a Windows Store app in C#.

    Tuesday, March 24, 2015 7:59 PM