Why are iOS modules not available for custom frameworks?

Xcode 5.0 (iOS 7.0 SDK) adds exciting new features - modules (see session 404 WWDC 2013).

This is great because it speeds up compilation time and eliminates the need to manually bundle frameworks. Well, Apple frameworks.

Apple Engineer in a WWDC conversation specifically noted that "modules are not available for custom frameworks." I understand that this means that it is impossible (or perhaps lead to failure?) To do this.

Why not?

EDIT

This question should not question whether it is β€œright” for such a restriction. Rather, "is there some kind of restriction with modules that prevent the creation of a user structure module"? Or maybe a security vulnerability ... I don’t know why this would have security problems, since it would still be a static structure?

+4
source share
2 answers

You can create modules for custom frameworks. This is described here: http://clang.llvm.org/docs/Modules.html

But the process is complicated, you need to know what you are doing or it will fall apart, and Apple does not currently provide any documentation or tools explaining how to make it work.

There is no difference between custom frameworks and official Apple frames. The only difference is that the Apple core was embedded in the module by someone who deeply understands how the compiler works, which is currently needed to create the module.

+3
source

This is just my guess.

The new module works similarly to a precompiled header with automatic linking of the static library. The great benefit comes from the fact that there is no need to parse the same set of headers in different compilation units. The compiler precompiles the structure headers and makes them reusable.

The main problem is that one project cannot have two precompiled headers. If the header is precompiled, the content should be the same in each compilation unit (.m file).

Suppose you can create a custom module:

mymodule.h

#ifndef MyCountType # define MyCountType int #endif static MyCountType counter_per_file; 

somefile.m

 #define MyCountType double #import "mymodule.h" // or @import "mymodule.h" 

someotherfilie.m

 #define MyCountType unsigned int #import "mymodule.h" // or @import "mymodule.h" 

So what should be the type of counter_per_file ? When precompiling mymodule.h compiler has no way to find out the type of MyCountType , it could be int or something else.

-one
source

All Articles