Hi, I have an iOS project with the following app targets:
- main iOS application
- a notification service extension
- 5 static libs containing some swift files with public methods
- 1 dynamic framework with above static libs as dependencies.
The framework only contains 2 files - a default .h file and 1 .exp file. This exports file contains mangled-names of all the public methods that are exposed by the 5 static libs present as framework's dependencies. I obtained these symbols using the nm command for each static lib.
The main iOS app target has 2 dependencies - the framework and the notification extension.
The notification extension only depends on the framework.
This setup works perfectly fine. I wanted to understand:
- If using the exports file is the only way to make this setup work?
- If not, what else can I do?
- What way does Apple recommend?
According to my requirements, I only need at-most 2-3 functions to be exposed by the framework - thus using a exports file just for that seems to bug me.
Thank you.
thus using a exports file just for that seems to bug me.
What part of this do you think is a bug?
In my experience, a .exp file is a great way to manage the symbols exported by your framework because it gives you explicit control. Other mechanisms tend to rely on implicit behaviour, which is a lot harder to understand.
So, are you concerned about the use of a .exp file at all? Or the mechanism you use to generate that file? Or that exporting all that extraneous stuff will costly?
Depending on what your actual concern is, there are a variety of less explicit options available to you. To learn more, search the ld man page for export and hidden.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"