Dynamic libraries by default and GHC 7.8
marlowsd at gmail.com
Thu Nov 29 09:29:11 CET 2012
On 28/11/12 23:15, Johan Tibell wrote:
> What does gcc do? Does it link statically or dynamically by default?
> Does it depend on if it can find a dynamic version of libraries or
If it finds a dynamic library first, it links against that.
Unlike GHC, with gcc you do not have to choose at compile-time whether
you are later going to link statically or dynamically, although you do
choose at compile-time to make an object for a shared library (-fPIC is
When gcc links dynamically, it assumes the binary will be able to find
its libraries at runtime, because they're usually in /lib or /usr/lib.
Apps that ship with their own shared libraries and don't install into
the standard locations typically have a wrapper script that sets
LD_LIBRARY_PATH, or they use RPATH with $ORIGIN (a better solution).
More information about the Glasgow-haskell-users