How to use a C++ dll in Windows Phone 8.1 XAML App within C++ Runtime Component

别来无恙 提交于 2020-01-13 18:01:28

问题


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)

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:

  • I want to use Angle (which allows OpenGL Code to be executed as DirectX on Windows/Windows Phone with the Microsoft fork: https://github.com/MSOpenTech/angle/tree/future-dev)
  • There are templates provided for Windows Phone 8.1 for pure C++ based on libEGL.lib/dll and libGLES.lib/dll (manually compiled for arm, win32)
  • But I want to use a C# project with C++ Runntime Component to be able to use third party libs like the admob ad framework for Windows Phone
  • I found out that cocos2d is using Angle but I have not figured out how they did it (https://github.com/cocos2d/cocos2d-x/tree/v3/templates/cpp-template-default/proj.wp8-xaml)

回答1:


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.



来源:https://stackoverflow.com/questions/27713435/how-to-use-a-c-dll-in-windows-phone-8-1-xaml-app-within-c-runtime-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!