large binaries

Simon Marlow
Fri, 19 Jul 2002 10:22:23 +0100

> > Is there some reason haskell binaries have to be statically linked?
> > I can't seem to find a way to make them otherwise, at least with
> > ghc.
> The ELF dynamic linking format seems to be designed on the assumption
> of poor code reuse (e.g., C code) where calls from one module to
> another are rare and can therefore be expensive.
> Haskell code has very high levels of reuse and calls from one module
> to another (especially calls into Prelude, List, Monad, etc) are very
> common so dynamic linking imposes a very high overhead.
> This isn't a reason to not support dynamic linking but it's a reason
> to make it a low priority.  Incidentally, it avoids confusion between
> the performance overhead of lazy evaluation and the performance
> overhead of dynamic linking of modular code.

Yes, and there are various other reasons too.  There's a FAQ question in
GHC's (rather well hidden) FAQ:

and a search through the glasgow-haskell-users archives will turn up
previous discussions.

Also, we do (or did) have support for dynamic libraries on Windows.