ghci attempts to link entire package

Simon Marlow simonmarhaskell at
Thu Jan 4 08:02:23 EST 2007

Bayley, Alistair wrote:
> Related to some of the problems Takusen users have had, I have a
> question about ghci's linker/loader: why does it appear to try to link
> an entire package archive, rather than just the modules that are used?
> This is in contrast to the GNU ld program which the compiler uses, which
> only tries to link modules which are actually used.
> Is this a feature or a bug?

Neither really, just a consequence of the design.  GHCi's linker only knows how 
to link object files, and when it links a package it actually linked a specially 
generated single .o file constructed by linking together all the object files in 
the package.

There has been talk of adding support to link .a files which would simplify 
package management, but I guess it might make linking slower.

If there's a use case that requires partial linking of a package, then we could 
consider the lack of partial linking a bug  - can you describe why you need it?


More information about the Glasgow-haskell-users mailing list