static library (aka static archive) is a collection of .o files with a table of contents that lists the global symbols in the .o files. ld will only pull .o files out of a static library if needed to resolve some symbol reference. man page of ld
static library (aka static archive) is a collection of .o files with a table of contents that lists the global symbols in the .o files. ld will only pull .o files out of a static library if needed to resolve some symbol reference. man page of ld
linkable binary Modules Declaration Clang Module Map, Swift Module declarations Headers Stripped in app Resources Prepared like in the app Info.plist Meta-data like version, copyright etc. Dependencies Can contain further frameworks and dylibs }Necessary for import & linking
dynamic library (aka dylib or framework) is a final linked image. Putting a dynamic library on the command line causes two things: 1) The generated final linked image will have encoded that it depends on that dynamic library. 2) Exported symbols from the dynamic library are used to resolve references. the man page of ld
dynamic library (aka dylib or framework) is a final linked image. Putting a dynamic library on the command line causes two things: 1) The generated final linked image will have encoded that it depends on that dynamic library. 2) Exported symbols from the dynamic library are used to resolve references. the man page of ld
4 5 6 #main.swift import monkey import BananaKit let m = MKMonkey(.Small) let t = BKBananaTree() t.fruits.first.peel(m) 1 2 3 4 5 6 7 8 9 10 11 12 #BananaKit.swift import monkey public class BKBananaTree { var fruits: [BKBananaFruit] public struct BKBananaFruit { var peeledByMonkey: MKMonkey? public func peel(m: MKMonkey) { peeledByMonkey = m } } } 1 2 3 4 5 6 7 8 9 10 #monkey.swift public enum MKSize { case Small case Big } public class MKMonkey { public let size: MKSize public init(_ size: MKSize) { self.size = size } }
Stripping Headers are only needed to integrate the library for the compiler and shouldn’t be shipped Code Signing Frameworks are all signed individually and excluded from the whole app bundle signature
LIBS Advantages Easier to distribute & integrate if compiled Reduces file size if used for app & extensions Separate resources in distinct bundles Disadvantages Optimization is limited to LTO Limits dead-code stripping Increases load times
We need to support Clang Modules, too. DSL-extensions for Podfile and Podspec Bundle Resources into Frameworks Workaround issues with swift-stdlib-tool Code Signing
lookup time Could be in library launching Could be in library code sign verification Looking like solution is on app deployment to bundle all framework symbols into one