Re: [問題] preprocessor和linker
※ 引述《ODEs (發奮丘溫泉隊)》之銘言:
: 我知道preprocessor會找到preprocessor directive, 然後將標頭檔(程式裡用到的函
: 式的函式庫)引入到程式裡面; 又linker會將object code和函式庫連結起來產生可執行檔
: . 那問題來了, 照這樣看起來, preprocessor和linker的功能不是一樣? 還是有我誤會的
: 地方? 謝謝大家.
兩者引入的東西是不一樣的
preprocessor 所 #include 進來的東西是函式宣告
linker 所引入的東西則是函式實際執行的程式碼
拿電路來比喻的話
preprocessor 引入的宣告就像是晶片元件說明書
根據說明書的指示我要在電路的哪些地方留接頭
而 linker 引入的程式碼則是那塊晶片元件本身
linker 做的動作就是實際把那塊晶片給接上電路去
大概像是這個樣子
--
'You've sort of made up for it tonight,' said Harry. 'Getting the
sword. Finishing the Horcrux. Saving my life.'
'That makes me sound a lot cooler then I was,' Ron mumbled.
'Stuff like that always sounds cooler then it really was,' said
Harry. 'I've been trying to tell you that for years.'
-- Harry Potter and the Deathly Hollows, P.308
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.28.91
推
03/08 20:07, , 1F
03/08 20:07, 1F
→
03/08 20:07, , 2F
03/08 20:07, 2F
→
03/08 20:08, , 3F
03/08 20:08, 3F
→
03/08 20:09, , 4F
03/08 20:09, 4F
→
03/08 20:09, , 5F
03/08 20:09, 5F
→
03/08 20:09, , 6F
03/08 20:09, 6F
→
03/08 20:10, , 7F
03/08 20:10, 7F
→
03/08 20:42, , 8F
03/08 20:42, 8F
推
03/08 20:49, , 9F
03/08 20:49, 9F
→
03/08 23:54, , 10F
03/08 23:54, 10F
推
03/09 15:21, , 11F
03/09 15:21, 11F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):