[英]What's the difference between GHC's -c and -no-link options?
The help says: 帮助说:
-c Do not link
and 和
-no-link Omit linking
I understand that -c
prevents the linking part completely. 我知道
-c
完全阻止链接部分。 But what's the difference if I specify -no-link
? 但是如果我指定
-no-link
什么区别? Does the linking phase actually do something apart from linking? 链接阶段实际上除了链接之外还做了什么吗?
Update: Interestingly, -no-link
is deprecated in GHC 6.12, but undeprecated in GHC 7 . 更新:有趣的是,
-no-link
在GHC 6.12中已被弃用,但在GHC 7中未被推荐 。
AFAK -c
doesn't handle dependencies. AFAK
-c
不处理依赖项。 Eg 例如
Main.hs: Main.hs:
module Main
where
import Test
main :: IO ()
main = test
Test.hs: Test.hs:
module Test
where
test :: IO ()
test = print 123
Trying to compile with -c
: 尝试使用
-c
进行编译:
$ ghc -c Main.hs
Main.hs:5:1:
Failed to load interface for `Test'
Use -v to see a list of the files searched for.
With -no-link
: 使用
-no-link
:
$ ghc -no-link Main.hs
[1 of 2] Compiling Test ( Test.hs, Test.o )
[2 of 2] Compiling Main ( Main.hs, Main.o )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.