Problems with main in a lib*.a. Is that a bug?

Simon Marlow
Thu, 12 Dec 2002 14:00:25 -0000

> Ok, I have made a "ghc -v"and see the problem :
> * on OS X, a SDL program must have a main function supplied=20
> by a lib :=20
> libSDLmain.a
> * This is achieved by adding -lSDLmain at the command line.
> * libHSrts.a supply a main. My program is linked against this=20
> lib by a -lHSrts.
> ld is called by ghc with args :
> [...] lHSrts [...] -lSDLmain [...]

Hmm, I just checked the source, and GHC definitely calls the linker
passing any -l options from the command line *before* -l options from
packages (-lHSrts comes from the rts package).  And I just tried a small
example with -lfoo on the command line, and it does indeed come before

So could you post *exactly* what you're doing, the full command lines
and the full output from ghc -v so we can see what's going wrong.