简体   繁体   中英

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. But what's the difference if I specify -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 .

AFAK -c doesn't handle dependencies. Eg

Main.hs:

module Main
where

import Test

main :: IO ()
main = test

Test.hs:

module Test
where

test :: IO ()
test = print 123

Trying to compile with -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 :

$ ghc -no-link Main.hs
[1 of 2] Compiling Test             ( Test.hs, Test.o )
[2 of 2] Compiling Main             ( Main.hs, Main.o )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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