如何从[C#WP8.1 WRT / SL]项目调用[Unmanaged C DLL func]
这不是“如何从C#调用C函数”的重复
我知道如何为普通的PC应用程序做这个,我试过它的工作原理: 这称为P / Invoke 1. Create a C++ dll project,but you can't add the C++ dll project as a reference to the C# project. Copy the dll from C++,and paste the dll to the C# exe folder 2. in C# use [DllImport...] in C++ use extern "C" __declspec(dllexport) ... 但是当我在WindowsPhone上执行此操作时,失败了. Windows Phone有2种类型的非托管c本机dll项目,我试过了 DLL (Windows Phone) <- WRT DLL 8.1 DLL (Windows Phone Silverlight 8.1) 我不知道在哪里放置dll文件. 所以我尝试将dll添加为C#WP8.1 SL项目中的resorce文件. 但是函数调用失败了. 所以我想知道的是,如何放置dll,如何使用WP8.1 SL项目连接dll? 以前有人试过吗? 谢谢你们的回答. // ———————————————— ———— 所以正确的方法是 create a [C++ Runtime Component DLL] <- as bridge create a [C++ Native WP SL DLL] <- real dll Add the [C++ Runtime Component DLL] as a reference to [C# WP8.1 SL] And the [C++ Native WP SL DLL] as a reference to [C++ Runtime Component DLL] 解决方法
托管Windows Phone项目中无法引用非托管程序集.在解决方案中创建Windows运行时组件,作为dll的包装器.您可以将其他非托管dll链接到运行时组件.
请阅读以下链接了解更多详情: Creating Windows Runtime Components How to import C++ dll in Windows Phone Project Consuming a C++ library project from a Windows Phone Store app Windows Runtime Component Sample-WP8.0 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |