Shared Libraries

Simon Marlow
Mon, 30 Apr 2001 11:28:51 +0100

> In the windows version of ghc,=20
> there seems to be the possiblity to compile
> the libraries as shared 'dll's. Is the=20
> same possible for the unix version?
> The question is because I think the ghc=20
> executables are really blown up. A simple
> 'Hello, world' has 358 KBytes and the hello
> example of the GTK+ bindings is as big as
> 2.2 MBytes, although it is link dynamically
> against:

358K looks a bit large: is that stripped?  I normally see a 150K-ish
minimum.  Most of that is the runtime system and garbage collector.

To answer your question: we don't currently have a way to make shared
libraries for Haskell code on Unix boxes.  I've made various attempts at
this in the past and didn't have much success - take a look back through
the glasgow-haskell-{users,bugs} archives for some more info on the

BTW, shared libraries aren't that big a deal.  You won't see any memory
savings unless you've got several Haskell programs running, and there
would certainly be a performance hit.  Also, there wouldn't be any of
the other "hot-swappable" advantages you normally get with shared
libraries, because GHC-compiled Haskell libraries tend to have a much
more intimate relationship with each other than C libraries.