如何在Windows Phone 8(C#)框架中添加C++ DLL

Dev*_*ove 12 c# dll dllimport visual-studio-2012 windows-phone-8

我试图Windows Phone 8在Visual Studio Express 2012中向框架添加C++ DLL .

我试过以下方法

  1. 通过PInvoke导入和调用

    [DllImport("WP8DLL.dll",CallingConvention = CallingConvention.Cdecl)]

    public static extern int functionReturningInteger();

    结果:这种方式虽然没有编译错误,但是当我尝试访问它抛出的DLL的方法时System.NotSupportedException.

  2. 在项目属性中添加引用

    结果:我收到消息"无法将对更高版本或不兼容程序集的引用添加到项目中 "

vid*_*ige 5

您无法将Managed Windows Phone 8 Project中的引用直接添加到本机静态或本机动态库.您需要创建Windows Phone运行时组件.这些可以由您的UI项目引用,也可以引用C++项目等.

有关详细信息,请参阅此链接.