package for ghci

S.D.Mechveliani [email protected]
Thu, 31 May 2001 09:59:59 +0400

To my question on packages for  ghci
Simon Marlow <[email protected]> responds

>> 5.  ar -q libHSfoo.a  *.o
>>     ld -r --whole-archive libHSdocon.a -o libHSdocon.o

> Here's your problem: you named the output libHSdocon.o, but GHCi is
> looking for HSfoo.o (because that's the name you gave in the package
> spec).
> ld -r --whole-archive libHSfoo.a -o libHSfoo.o
> [..]

Thank you. 
The matter was indeed in the name.
And it was due to the `lib' prefix, not due to `docon'.

Because there was a typo in my letter: 
                                ...--whole-archive libHSfdocon.a ...
while in real experiment it was ...--whole-archive libHSfoo.a    ...

And I doubt whether the GHC implementation agrees at this point with 
the GHC User's guide. Section 4.11.2 says

  A package specification looks like this:

  Package {name         = "mypkg"
           hs_libraries = ["HSmypkg"]
      A list of libraries containing Haskell code for this package,
      with the .a or .dll suffix omitted.
      On Unix, the `lib' prefix is also omitted.

    extra_libraries  ... 

The user (myself) thinks at this:
"HSmypkg" in package specification --> <prefix?>HSmypkg.a
                                       in the library directory.

But  " `lib' is also omitted "   - similarly as `.a'.
Hence, the library directory should contain
                                           libHSmypkg.a libHSmypkg.o
Now,       ghci -package-mypkg  

sees "HSmypkg" in package specification but searches for the file  
It adds `.o', but skips `lib'.
On the other hand, `.o' has different status, it is separated by
period. So I wonder.


Serge Mechveliani
[email protected]