Linking with object files

Adrian Hey
Mon, 6 Jan 2003 15:20:42 +0000


I seem to be having some trouble doing this and have a couple of questions..

The first question is how do you use --make option when doing this?
Section 4.5 of the users guide seems to contradictory to me.

It states..
 "The command line must contain one source file or module name"

and later..
 "If the program needs to be linked with additional objects (say, some
  auxilliary C code), these can be specified on the command line as usual."

> ghc Main.hs foo.o
is OK, but whenever I try this...

> ghc --make Main.hs foo.o
I get the error.. can't find module 'foo.o' <while processing "foo.o">

The second question is what object formats does ghc understand and is the
object file suffix significant? If I try elf format, this is accepted without
complaint but I get a broken executable (though this could well be because
my assembler has generated a broken elf file). Using coff format seems OK.
The files have a ".o"  suffix in both cases.

FWIW, I'm using ghc 5.04.2 on Win32 with the nasm assembler.

Adrian Hey