• <bdo id='h0JMX'></bdo><ul id='h0JMX'></ul>
      <legend id='h0JMX'><style id='h0JMX'><dir id='h0JMX'><q id='h0JMX'></q></dir></style></legend>
    1. <small id='h0JMX'></small><noframes id='h0JMX'>

    2. <i id='h0JMX'><tr id='h0JMX'><dt id='h0JMX'><q id='h0JMX'><span id='h0JMX'><b id='h0JMX'><form id='h0JMX'><ins id='h0JMX'></ins><ul id='h0JMX'></ul><sub id='h0JMX'></sub></form><legend id='h0JMX'></legend><bdo id='h0JMX'><pre id='h0JMX'><center id='h0JMX'></center></pre></bdo></b><th id='h0JMX'></th></span></q></dt></tr></i><div id='h0JMX'><tfoot id='h0JMX'></tfoot><dl id='h0JMX'><fieldset id='h0JMX'></fieldset></dl></div>

    3. <tfoot id='h0JMX'></tfoot>

        跨 CPU 架构从 Windows 10 通用应用程序引用 C Dll

        时间:2023-09-15

          <tbody id='ZFHAF'></tbody>
        <tfoot id='ZFHAF'></tfoot>

            • <i id='ZFHAF'><tr id='ZFHAF'><dt id='ZFHAF'><q id='ZFHAF'><span id='ZFHAF'><b id='ZFHAF'><form id='ZFHAF'><ins id='ZFHAF'></ins><ul id='ZFHAF'></ul><sub id='ZFHAF'></sub></form><legend id='ZFHAF'></legend><bdo id='ZFHAF'><pre id='ZFHAF'><center id='ZFHAF'></center></pre></bdo></b><th id='ZFHAF'></th></span></q></dt></tr></i><div id='ZFHAF'><tfoot id='ZFHAF'></tfoot><dl id='ZFHAF'><fieldset id='ZFHAF'></fieldset></dl></div>
                <bdo id='ZFHAF'></bdo><ul id='ZFHAF'></ul>
              • <legend id='ZFHAF'><style id='ZFHAF'><dir id='ZFHAF'><q id='ZFHAF'></q></dir></style></legend>

                1. <small id='ZFHAF'></small><noframes id='ZFHAF'>

                  本文介绍了跨 CPU 架构从 Windows 10 通用应用程序引用 C Dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  基本问题/摘要:我需要从 Win 10 通用应用项目中引用其他人用 C 语言创建的二进制文件 (dll).但是,x86 和 arm 有一个单独的 dll.我相信我需要从项目中引用 dll(或至少 winmd 文件)才能部署它,但我只能引用一个文件,不能同时引用这两个文件.这意味着应用程序在一个或另一个平台(桌面或手机)上失败,因为它包含错误的二进制文件.正在寻找解决方案.

                  Basic question/summary: I need to reference a binary (dll) created by someone else in C from a Win 10 universal app project. However, there is a separate dll for x86 and arm. I believe I need to reference the dll (or at least winmd file) from the project for it to be deployed, but I can only reference one file not both. That means the app fails on one platform or another (desktop or phone) because it has the wrong binary included. Looking for a solution.

                  更详细的解释;

                  我正在尝试编写通用 Windows 应用程序(新的 Windows 10 样式).这意味着我有一个项目可以添加对外部组件的引用.

                  I am trying to write a Universal Windows application (new Windows 10 style). This means I have a single project to add references to external components to.

                  我需要一些最好作为第三方组件购买而不是内部开发的图像处理工具.支持 WinRT 的第三方提供了多个 SDK,但没有一个专门支持 UWA.然而,WinRT SDK 都有用于 Windows Phone 和 Windows 桌面应用程序的不同二进制文件.并且二进制文件都是从 C/C++ 源代码创建的.这对于较旧的通用"应用程序来说很好,因为手机和桌面有一个单独的项目,因此您可以在每个项目中引用不同的组件,但现在只有一个项目可以添加引用.

                  I have the need for some image processing stuff that is best bought as a 3rd party component rather than developed in house. There are several SDK's available from 3rd parties that support WinRT but none that specifically support UWA. The WinRT SDK's however all have different binaries for Windows Phone and Windows Desktop apps. and the binaries are all created from C/C++ source. This was fine with the older 'universal' apps because there was a separate project for phone and desktop so you could just reference different components in each project, but now there's only one project to add references to.

                  我向一家供应商询问了有关 UWA 支持的问题,他们声称这是不可能的,他们无法创建针对两个平台(arm 与 x86)的单个二进制文件,并且他们不知道我的 UWA 引用正确文件的方法当应用程序针对适当的架构构建时(这是我认为应该发生的).

                  I asked one supplier about UWA support and they claimed it was impossible, they couldn't create a single binary to target both platforms (arm vs x86) and they didn't know a way for my UWA to reference the right file when the app is built for the appropriate architecture (which is what I assume should happen).

                  假设有某种方式(可能在 winmd 文件中?)说,'嘿,这是不同 CPU 架构的同一个 dll 的两个副本,选择你正在构建的那个'只要公共 API 匹配,应用程序就使用正确的 API?

                  I assume there is someway (perhaps in a winmd file?) to say, 'hey, here's two copies of the same dll for different CPU architectures, pick the one you're building for' and so long as the public API matches the app just uses the right one?

                  有解决办法吗?有谁知道这种参考应该如何工作?还是我运气不好?

                  Is there a solution for this? Does anyone know how this sort of reference is supposed to work? Or am I just out of luck?

                  谢谢.

                  推荐答案

                  有一种方法可以在项目中引用具有不同架构的同一个 DLL,但您不能直接从 VS 中执行此操作.您必须手动编辑 csproj 文件.

                  There is a way to reference the same DLL with different architectures in a project but you cannot do it from VS directly. You will have to manually edit the csproj file.

                  在您的 csproj 文件中,您必须转到底部并找到这些部分.这些部分引用了您的所有文件.

                  In your csproj file, you will have to go to the bottom and locate the sections. These sections reference all your files.

                  项目定义中有一个特殊的标签,它允许您告诉 Visual Studio 根据某些条件执行某些特定操作.然后,您可以创建一个将引用您的 DLL 依赖项的组.您的 csproj 文件将如下所示:(我已删除所有不相关的内容)

                  There is a special tag in the project definition which allows you to tell Visual Studio to perform some specific actions based on some conditions. You can then create a group which will reference your DLL dependencies. Your csproj file will then be as the following: (I've removed all the non-relevants things)

                  <Project>
                    <PropertyGroup />
                    <PropertyGroup />
                    <PropertyGroup />
                    <ItemGroup />
                    <ItemGroup />
                    <Choose>
                      <When Condition=" '$(Platform)' == 'x86' ">
                        <ItemGroup>
                          <Content Include="..Binariesx86MyLib1.winmd">
                              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                          </Content>
                           <Content Include="..Binariesx86MyLib2.winmd">
                            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                          </Content>
                        </ItemGroup>
                      </When>
                      <When Condition=" '$(Platform)' == 'ARM' ">
                        <ItemGroup>
                          <Content Include="..BinariesARMMyLib1.winmd">
                              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                          </Content>
                           <Content Include="..BinariesARMMyLib2.winmd">
                            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                          </Content>
                        </ItemGroup>
                      </When>
                    </Choose>
                    <Import />
                    <Import />
                  </Project>
                  

                  我已经在 VS2013 上将它用于一些 Windows Phone 项目(使它们在手机和模拟器上都可以工作).我没有在 Windows 10 和 VS2015 上进行过测试,但它应该以相同的方式工作.

                  I've used it on VS2013 for some Windows Phone projects (to make them work both on the phone and the emulator). I've not tested on Windows 10 and VS2015 but it should work the same way.

                  这篇关于跨 CPU 架构从 Windows 10 通用应用程序引用 C Dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:打开停靠在 WPF 中的 Windows 10 触摸键盘 下一篇:从 Windows 10 的快速访问菜单中以编程方式 PinUnPin 文件夹

                  相关文章

                    <legend id='AJTtp'><style id='AJTtp'><dir id='AJTtp'><q id='AJTtp'></q></dir></style></legend>

                      <small id='AJTtp'></small><noframes id='AJTtp'>

                      <tfoot id='AJTtp'></tfoot>
                      <i id='AJTtp'><tr id='AJTtp'><dt id='AJTtp'><q id='AJTtp'><span id='AJTtp'><b id='AJTtp'><form id='AJTtp'><ins id='AJTtp'></ins><ul id='AJTtp'></ul><sub id='AJTtp'></sub></form><legend id='AJTtp'></legend><bdo id='AJTtp'><pre id='AJTtp'><center id='AJTtp'></center></pre></bdo></b><th id='AJTtp'></th></span></q></dt></tr></i><div id='AJTtp'><tfoot id='AJTtp'></tfoot><dl id='AJTtp'><fieldset id='AJTtp'></fieldset></dl></div>

                        <bdo id='AJTtp'></bdo><ul id='AJTtp'></ul>