The -static option of ghc, and choice between user-supplied library types (Unix)

Dimitry Golubovsky golubovsky at
Wed Jan 11 12:23:35 EST 2006

The Paragraph 4.10.7 of the GHC users guide contains this:

Tell the linker to avoid shared Haskell libraries, if possible. This
is the default.

Tell the linker to use shared Haskell libraries, if available (this
option is only supported on Mac OS X at the moment, and also note that
your distribution of GHC may not have been supplied with shared

As I understand, this is related to the GHC own libraries. What about
user-supplied libraries (listed in the `extra-libraries' field of a
Cabal package description) e. g.:

extra-libraries: gd, jpeg, m


There are usually files like libm.a and together in the same
directory where GHC looks for libraries.

Does the -static / -dynamic ghc flag affect the choice which library
to link against?Or, to control this, one has to descend to the linker
options, and the default would be the linker default?

I believe, this is Unix-specific: AFAIR on Windows (and OS/2) dynamic
implibs were indistinguishable by their names from static libraries
and had the .lib suffix anyway?

Dimitry Golubovsky

Anywhere on the Web

More information about the Glasgow-haskell-users mailing list