<tfoot id='SKrrv'></tfoot>
      1. <legend id='SKrrv'><style id='SKrrv'><dir id='SKrrv'><q id='SKrrv'></q></dir></style></legend>
        • <bdo id='SKrrv'></bdo><ul id='SKrrv'></ul>

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

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

        框架的私有模块映射

        时间:2023-05-18
        • <tfoot id='mviW2'></tfoot>

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

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

                  <tbody id='mviW2'></tbody>
                • <bdo id='mviW2'></bdo><ul id='mviW2'></ul>

                  本文介绍了框架的私有模块映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用 this answer 创建一个模块映射来为 CommonCrypto 创建一个模块,这样我就可以在一个框架.

                  I'm using this answer to create a module map to create a module for CommonCrypto so I can use it in a framework.

                  但是,这样做意味着我使用此框架的任何项目都可以通过 import CommonCrypto 访问 CommonCrypto - 更糟糕的是,在另一个框架中声明 CommonCrypto 并将其导入项目会导致 重新定义模块CommonCrypto" 错误.

                  Doing this however means that any projects that I use this framework in have access to CommonCrypto with import CommonCrypto - and even worse, declaring CommonCrypto in another framework and importing this into the project results in Redefinition of module 'CommonCrypto' errors.

                  即以下设置:

                  MainProject
                      |--> import FrameworkA - module map for CommonCrypto
                      |--> import FrameworkB - module map for CommonCrypto
                  

                  有没有办法创建一个模块映射,但让它私有于它创建/使用的框架?(很像框架的 Swift 中的 internal 访问属性).llvm Clang 文档 显示了一个 private 属性 但我不知道在我的模块映射中放置这个,甚至可能不是为了这个目的!还有一个 export 属性 但我又一次'不完全确定如何使用它...!

                  Is there a way to create a module map but have it private to that Framework its created/used in? (Much like the internal access attribute in Swift for a Framework). The llvm Clang docs show a private attribute but I can't work out where to put this in my module map, and it might not even be for this purpose! There's also an export attribute but again I'm not entirely sure how to use this...!

                  这是我用于 CommonCrypto 的模块映射 - $(SDKROOT) 在构建阶段被换出到正确的位置(对于 iphoneosiphonesimulator SDKs):

                  This is my module map I'm using for CommonCrypto - the $(SDKROOT) gets swapped out in a build phase to the correct location (for iphoneos or iphonesimulator SDKs):

                  module CommonCrypto [system] [extern_c] {
                      umbrella header "$(SDKROOT)/usr/include/CommonCrypto/CommonCrypto.h"
                      export *
                  }
                  

                  FrameworkA/FrameworkB 中使用这很好(除了你不能去定义",但我不介意).

                  This works fine (except you can't "go to definition" but I don't mind that) for use in FrameworkA / FrameworkB.

                  推荐答案

                  免责声明:我没有为 CommonCrypto 尝试过这个,但它适用于我的情况

                  Disclaimer: I have not tried this for CommonCrypto but it works for my case with libz

                  一个可能的解决方案是创建一个 module.private.modulemap,如 Clang 文档

                  A possible solution to this is to create a module.private.modulemap as described in the Clang documentation

                  因此,例如在 FrameworkA 中,您可以为 FrameworkA 编写一个 module.modulemap 文件,如下所示:

                  So for example in FrameworkA you can write a module.modulemap file for FrameworkA like so:

                  module FrameworkACommon {
                  }
                  

                  然后你会像这样创建一个 module.private.modulemap 文件

                  Then you would create a module.private.modulemap file like so

                  explicit  FrameworkACommon.Crypto [system] [extern_c] {
                     header "/Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/usr/include/CommonCrypto/CommonCrypto.h"
                      link "CommonCrypto"
                      export *
                  }
                  

                  然后对 FrameworkB 重复.

                  现在 CommonCrypto 是 FrameworkA 和 FrameworkB 中的私有模块,名称不会冲突.

                  Now CommonCrypto is a private module in both FrameworkA and FrameworkB and the names won't clash.

                  这篇关于框架的私有模块映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:XCTest.framework 构建错误 下一篇:带有子项目和项目依赖项的 Xcode 工作区触发构建

                  相关文章

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

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