
To my question on packages for ghci
Simon Marlow
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"]
...
}
...
hs_libraries
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 -->