12

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 ?

technerd
  • 14,144
  • 10
  • 61
  • 92

1 Answers1

4

Objective-C Module Map(.modulemap) for Objective-C and Swift

Objective-C language exposes API through .modulemap for Objective-C and Swift languages

[ObjC Module]

[Custom .modulemap]

It is about LLVM Modules and Module Map Language. Modulemap exposes C header files for external binaries. It is a bridge between module and headers. Modulemap helps to convert #include, #import -> @import because it has a mapping between module name and headers inside. Also modulemap helps to create standalone additional modules and submodules. Modulemap can contains a lot of modules(only one has to have the same name as product name) and a lot of submodules

//Objective-C exposes API through .modulemap for Objective-C and Swift

.h.m uses .h.m = Objective-C consumer, Objective-C producer = .modulemap
.swift uses .h.m = Swift consumer, Objective-C producer = .modulemap

Framework which includes .modulemap is called Modular Framework. Path:

module_name.framework/Modules/module_name.modulemap

Setup

  • When you create a library[Example] you should create and setup it manually
  • When you create a framework[Example] it is setup automatically

Even if you create Swift framework Xcode automatically creates modulemap

[Mixing Objective-C and Swift in the same Application]

mfaani
  • 33,269
  • 19
  • 164
  • 293
yoAlex5
  • 29,217
  • 8
  • 193
  • 205
  • 3
    This does not answer what `export` means. – ray Jan 19 '22 at 17:03
  • @ray, https://stackoverflow.com/questions/30704268/no-umbrella-header-found-for-target-module-map-will-not-be-generated/57665560#57665560 – yoAlex5 Jan 19 '22 at 17:07