GHCI and archive libraries.

Lennart Augustsson lennart at
Sat Dec 3 09:17:47 EST 2005

And on many platforms (well, at least a few years ago) a "shared"
library doesn't have to be PIC.  The dynamic loader can do relocation
when it loads the file.  (Then it can't be shared.)

But this was a few years ago on Solaris and BSDs, it could be
different now.

	-- Lennart

Sven Panne wrote:
> Am Samstag, 3. Dezember 2005 14:48 schrieb Lennart Augustsson:
>>Can't you unpack the ar library and then link the object files
>>into a shared library?
> On most platforms the code in a *.a library is not shared library code, e.g. 
> it is not PIC or something like that. Nevertheless, I think that the *.o 
> files GHCi loads are not exactly shared libraries, they are incrementally 
> linked relocatable object code (correct me if I'm wrong here, the details of 
> shared libraries are still a kind of black art...). So you might have luck 
> with unpacking and re-linking like that:
>    ar x libblah.a
>    ld -r -x -o /my/new/blah.o *.o
> The linker flags for doing this vary, depending on the platform, you can have 
> a look at GHC's autoconf magic for hints if it doesn't work like mentioned 
> above.
> Cheers,
>    S.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list