楼主:
uranusjr (â†é€™äººæ˜¯è¶…級笨蛋)
2014-02-14 12:36:17全删
Framework = Versioned(Headers + Lib + Resources) + Metadata
随便开一个内建的看就知道了
$ ls /System/Library/Frameworks/Foundation.framework/
Foundation Headers Resources Versions XPCServices module.map
module.map 用来指示该 framework 要 export 的东西
(应该和 Windows 的 Manifest 差不多, 虽然其实我不太懂那个所以不确定XD)
除了 Versions 以外其他都是 soft link 到 Versions 里面
$ ls -l /System/Library/Frameworks/Foundation.framework/Versions/
drwxr-xr-x 6 root wheel 238 Dec 25 18:07 C
lrwxr-xr-x 1 root wheel 1 Dec 24 18:31 Current -> C
没难度, 跳过
$ ls -l /System/Library/Frameworks/Foundation.framework/Versions/C
total 7808
-rwxr-xr-x 1 root wheel 10474768 Dec 24 18:31 Foundation
drwxr-xr-x 2 root wheel 4930 Oct 1 04:04 Headers
drwxr-xr-x 36 root wheel 1462 Dec 24 18:32 Resources
drwxr-xr-x 3 root wheel 102 Aug 27 12:06 XPCServices
drwxr-xr-x 2 root wheel 102 Dec 24 18:31 _CodeSignature
第一个就是 library 本体, 第二三个应该很容易理解
第四个其实也是一个 resource, 最后就...code signature
Framework 被引用的时候通常都是会使用 Current 版本
但是根据状况可能在 Versions 里面可以有很多个项目, Current 指向其中一个
这样就可以消除 binary incompatibility 的问题
作者:
HuangJC (吹笛牧童)
2014-02-14 15:47:00以前 .h 给 compiler 看(而且引用者必需明确 include).lib 给 linker 用;所以其实没引入 lib 是会有 link error有引入 lib 但没明确 include 呢? 那 compile time 就 err现在有 framework,包装里有 .h,但你还是得自己 include所以我感受到的好处只有.. "大哥都替你包在一起,省得找"了倒是 include 时,我常省略打路径,compiler 竟也找得到这实在开心多了,如果 framework打包有这好处,那就'有感'(有感 是最近流行的字眼吧 :P)