如何在C ++运行时组件中的Windows Phone 8.1 XAML App中使用C ++ DLL

我想在我的C#windows phone 8.1 XAML visual studio项目中使用C ++ dll(为arm编译,x86)。

我创建了一个C ++运行时组件来与我的C ++代码进行交互。 此代码需要预编译的dll。 我将我的lib文件添加到我的项目设置中。 编译运行正常。 如果我使用Windows Phone 8.1模拟器启动我的应用程序,我会得到:

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

我的Visual Studio项目结构:

  • C#
    • Windows Phone项目
    • Windows项目
    • 共享XAML
  • 托管C ++
    • RuntimeComponent Windows Phone
    • RuntimeComponent Windows
    • 共享C ++代码(这里使用的DLL)

在此处输入图像描述

我尝试过的事情:

  • 我将dll拖放到我的C ++项目中,并将内容属性更改为true。
  • 我将dll拖放到我的C#项目中并启用了将dll复制到输出目录的选项

那么,我如何在C ++运行时组件项目中使用.lib / .dll库?

更多细节:

  • 我想使用Angle(允许OpenGL代码在Windows / Windows Phone上使用Microsoft fork作为DirectX执行: https : //github.com/MSOpenTech/angle/tree/future-dev )
  • 基于libEGL.lib / dll和libGLES.lib / dll(为arm,win32手动编译)提供了适用于纯C ++的Windows Phone 8.1模板
  • 但我想使用C ++ Runntime组件的C#项目能够使用第三方库,如Windows Phone的admob广告框架
  • 我发现cocos2d正在使用Angle,但我还没弄清楚他们是如何做到的( https://github.com/cocos2d/cocos2d-x/tree/v3/templates/cpp-template-default/proj.wp8-xaml )

我设法让它运作起来。

您必须将dll导入C#项目。 重要的是,dll位于C#项目的根目录中,并且: 激活copy to output directory