繁体   English   中英

GHC的-c和-no-link选项有什么区别?

[英]What's the difference between GHC's -c and -no-link options?

帮助说:

 -c  Do not link

 -no-link  Omit linking

我知道-c完全阻止链接部分。 但是如果我指定-no-link什么区别? 链接阶段实际上除了链接之外还做了什么吗?

更新:有趣的是, -no-link 在GHC 6.12中已弃用,但在GHC 7中未被推荐

AFAK -c不处理依赖项。 例如

Main.hs:

module Main
where

import Test

main :: IO ()
main = test

Test.hs:

module Test
where

test :: IO ()
test = print 123

尝试使用-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.

使用-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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM