On 04 March 2005 16:22, Wolfgang Thaller wrote:

> The only thing about dynamic linking that you need to know to
> understand this is that dynamic libraries in GHC get the _dyn suffix
> so that we are in control of whether they are used or not. If we just
> had libHSfoo.[dylib|so], then it would be quite hard to prevent ld
> from using that when we want a static build. Passing -static to
> gcc/ld is too extreme, after all, we still want to dynamically link
> to all the "foreign" libraries.
> For every entry "foo" in hs-libraries, GHC generates a -l option like
> -lfoo, -lfoo_p, -lfoo_dyn or -lfoo_p_dyn depending on the profiling
> and dynamic linking settings.
> For entries in extra-libraries, GHC doesn't do this, so "X11" will
> just be used as -lX11.
> 
> Now libHSbase_cbits is in extra-libraries, because we don't need a
> separate profiling version. But we do want to use -lHSbase_cbits_dyn
> if -dynamic is specified and plain old -lHSbase_cbits if it's not.
> However if we move it from extra-libraries to hs-libraries, then GHC
> will use -lHSbase_cbits_p when profiling.
> 
> So the current situation is that libHSbase_cbits.a and
> libHSbase_cbits_dyn.dylib are built and installed, but when you link
> an executable using -dynamic, only the first of the two will ever get
> used (the latter actually gets used by GHCi in a "dynamic" build of
> GHC). 

I think the right way to fix this would be to have the compiler
automatically replace the string $(dyn) in extra_libraries with either
"_dyn" or "".  In a similar way, we could have $(way) replaced by either
"_p" or "", and then an entry in hs_libraries for "HSbase" would be
shorthand for "HSbase$(way)$(dyn)" in extra_libraries.  Sound
reasonable?

Cheers,
        Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to