问题描述
我创建了一个名为Communication
的框架,在框架容器中有一个module.modulemap
文件.
I have created one framework named Communication
, inside framework container there is one module.modulemap
file.
module.modulemap
framework module Communication {
umbrella header "Communication.h"
export *
module * { export * }
}
我可以理解该模块需要伞头才能将其公开给包含应用程序/目标的对象.
I can understand that module required umbrella header to expose it to containing application/target.
但是其他两行代码是什么意思.
But what is meaning of other two lines of code.
export *
module * { export * }
如果知道这行输出是什么?
If any have idea what this lines exporting ?
推荐答案
Modular Framework
在下一个路径中包含.modulemap
文件
Modular Framework
contains .modulemap
file in the next path
module_name.framework/Modules/module_name.modulemap
至于命名,我的规则是
ProductName -> Product Module Name -> <name>.modulemap -> framework module <name>
创建库时,您应该手动创建并设置它,当您创建框架时如果Build Settings -> Defines Module -> YES
,Xcode会自动生成它.
When you create a library you should create and setup it manually, when you create a framework Xcode generates its automatically if Build Settings -> Defines Module -> YES
.
创建自己的.modulemap
文件时,您必须更新Build Settings -> Module Map File
When you create your own .modulemap
file you have to update a path in Build Settings -> Module Map File
让我们看一下示例:
注意:我使用explicit module
来表明Xcode会产生错误
Lets take a look at the example:
Note: I use explicit module
to show that Xcode will generate errors
//ClassA.h
#import "ClassAA.h"
//ClassB.h
//ClassAA.h
//Module.h
#import "ClassA.h"
#import "ClassB.h"
//Module.modulemap
framework module Module {
//Expose all imports from Module.h for Module module recursively
// import Module - you can use ClassA, ClassB, ClassAA
umbrella header "Module.h"
//explicit module * { }
// 1. `module` works only with `umbrella`
// 2. Generates a submodule for every header inside Module.h recursively
// import Module.ClassA, import Module.ClassB, import Module.ClassC
//explicit module * { export * }
//export all imports from <submodule_name>.h for <submodule_name> module
// import Module.ClassA - you can use ClassA, ClassAA (ClassAA was added)
explicit module * { export * }
//export all imports from Module.h for Module module
// import Module.ClassA - you can use ClassA, ClassAA, ClassB(ClassB was added)
export *
}
这篇关于每个框架内的module.modulemap文件中的export *是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!