3
votes

I want to use a C++ dll (compiled for arm, x86) within my C# windows phone 8.1 XAML visual studio project.

I created a C++ runtime component to interact with my C++ code. This code needs a precompiled dll. I added my lib file to my project settings. The compilation is running fine. If I start my app with the windows phone 8.1 emulator I get:

The specified module could not be found. (Exception from HRESULT: 0x8007007E)

My Visual Studio Project Structure:

  • c#
    • Windows Phone Project
    • Windows Project
    • Shared XAML
  • Managed C++
    • RuntimeComponent Windows Phone
    • RuntimeComponent Windows
    • Shared C++ Code (dll used here)

enter image description here

Things I have tried:

  • I dragged and dropped the dll into my C++ project and changed properties of content to true.
  • I dragged and dropped the dll into my C# project and enabled the option to copy the dll to the output directory

So, how can I use a .lib/.dll library within a C++ Runtime Component Project?

Some more details:

1
Is this what you are trying to do? - AR5HAM
No I do not want to call C++ Code directly within C# code. The C# code calls a runtime component method (managed c++) and within this managed c++ code I want to use a C++ dll. - Bastl
To link with the library, you might have to add the .lib file to the project configuration under Linker/Input/Additional Dependencies. - AR5HAM
I have already added the lib file there - Bastl
did you also right click on dll > include in project? - AR5HAM

1 Answers

1
votes

I managed to get it working.

You have to import the dll into the C#-project. It's important that the dll is in the root the C#-project and that: copy to output directory is not activated.