Re: [問題] Framework 是什麼?

看板MacDev作者 (←這人是超級笨蛋)時間11年前 (2014/02/14 12:36), 編輯推噓1(107)
留言8則, 1人參與, 最新討論串2/2 (看更多)
全刪 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 的問題 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.94.57

02/14 15:47, , 1F
以前 .h 給 compiler 看(而且引用者必需明確 include)
02/14 15:47, 1F

02/14 15:48, , 2F
.lib 給 linker 用;所以其實沒引入 lib 是會有 link error
02/14 15:48, 2F

02/14 15:48, , 3F
有引入 lib 但沒明確 include 呢? 那 compile time 就 err
02/14 15:48, 3F

02/14 15:49, , 4F
現在有 framework,包裝裏有 .h,但你還是得自己 include
02/14 15:49, 4F

02/14 15:50, , 5F
所以我感受到的好處只有.. "大哥都替你包在一起,省得找"了
02/14 15:50, 5F

02/14 15:51, , 6F
倒是 include 時,我常省略打路徑,compiler 竟也找得到
02/14 15:51, 6F

02/14 15:51, , 7F
這實在開心多了,如果 framework打包有這好處,那就'有感'
02/14 15:51, 7F

02/14 15:52, , 8F
(有感 是最近流行的字眼吧 :P)
02/14 15:52, 8F
文章代碼(AID): #1I_Pr4J4 (MacDev)
文章代碼(AID): #1I_Pr4J4 (MacDev)