简体   繁体   English

Dll导入C#Metro风格的应用程序

[英]Dll Import in C# metro style application

I want to use in my C# metro app function from C++ library I'm trying to do it as usual [DllImport("MyLibrary.dll")] and put the dll in bin\\debug folder of the application. 我想在C ++库的C#Metro应用程序函数中使用,我想像往常一样[DllImport("MyLibrary.dll")]并将dll放入应用程序的bin \\ debug文件夹中。 when it run I get an exception "Unable to load DLL 'MyLibrary.dll' : The specified module could not be found. (Exception from HRESULT: 0x8007007E)" What can I do please? 当它运行时,出现异常“无法加载'MyLibrary.dll' :找不到指定的模块。(来自HRESULT的异常:0x8007007E)”我该怎么办?

Is the DLL in your package? DLL是否在您的包装中? Add it to the project and make the type Content. 将其添加到项目中,然后输入内容。 If it is not deployed with your app, you can't use it. 如果未随应用程序一起部署,则无法使用。

I had some issues with that too. 我也有一些问题。 My solution has been rather simple and not given in any other place: 我的解决方案非常简单,没有在其他任何地方给出:

Copy the next two dlls in the same folder: 将接下来的两个dll复制到同一文件夹中:

libgcc_s_dw2-1.dll libgcc_s_dw2-1.dll

libstdc++-6.dlll libstdc ++-6.dlll

I tried to use "mylib.dll" in a cpp coded aplication and the system asked me to include those files. 我试图在cpp编码的应用程序中使用“ mylib.dll”,系统要求我包括这些文件。 And suddenly, the app I was developing didn't complain any more about not being able to find "mylib.dll". 突然之间,我正在开发的应用程序再也没有抱怨无法找到“ mylib.dll”。 Don't asky me why. 不要问我为什么。

Cheers, Haritz Zabaleta 干杯,哈里兹·扎巴莱塔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM