Dynamic libraries and GHCi

Simon Marlow marlowsd at gmail.com
Mon May 17 04:54:48 EDT 2010


On 16/05/2010 20:49, Ian Lynagh wrote:
> On Mon, May 10, 2010 at 10:06:21AM +0100, Simon Marlow wrote:
>>
>>   - we make -dynamic the default.
>>
>> It's perhaps worth investigating the consequences of the first option,
>> making -dynamic the default.  Cabal would have to --enable-dynamic by
>> default - perhaps it would get an --enable-static that could even be
>> *off* by default.
>
> I'm a bit confused. When you say "we make -dynamic the default", do you
> mean "ghc foo.hs" uses the dynamic way?

Yes.

> Isn't the important thing that Cabal builds libs the dynamic way by
> default?

That too.  But the point is that if you say

$ ghc -c hello.hs
$ ghci hello

then it works, rather than giving you an obscure error about needing to 
recompile hello.hs with -dynamic, or perhaps ignoring the .o file 
completely.

A separate issue is that if you say

$ cabal install foo
$ ghci -package foo

then it should work, rather than giving you an obscure error telling you 
to 'cabal install foo --enable-dynamic --reinstall', or something.

> We'd still have to build them the static way too, if ghc keeps using
> static by default.

Well, perhaps static would not be the default any more.

I'm just trying to explore the design space here, at the moment I don't 
see a solution that is win-win.

Cheers,
	Simon



More information about the Glasgow-haskell-users mailing list