[Haskell] Using -main-is with GHC 6.4/Windows

Graham Klyne gk at ninebynine.org
Fri Mar 18 05:38:38 EST 2005

At 09:29 18/03/05 +0000, Simon Peyton-Jones wrote:
>[Redirecting to GHC users, which is where GHC-specific questions belong]

OK (but I'm not subscribed to that list, so pls copy me on any further 
comment, if any.)

>| OK, it's not so bad.  If I delete the AffyDataCalc.o file before
>| AffyDataCalcTest, it all works fine.
>| Hmmm... is there something the GHC --make feature can do to force
>| recompilation of the other modules previously compiled as main
>| modules?  Just a thought.
>We're always wary of adding too much magic!

I can appreciate that.  It did strike me as a little strange (magic, even?) 
that the result of compiling a module named explicitly on the GHC command 
line is different from the implicit compilation performed when chasing 
imports.  (I think I understand *why* it happens, but it still seems a 
little strange.)  By way of exploring the issue, rather than actually 
asking for any of the following to be done, some thoughts I had are:
(a) generate the program initialization/finalization entry points in a 
separate .o file from the compiled module, and include that in the link.
(b) use a different output filename (e.g. module_main.o) when compiling a 
module as a program entry point.
(c) combination of (a) and (b) - compile base module as non-main, and a 
separate output file for the program startup magic with a name based on but 
different from the corresponding source module.

>I'll add a note to the
>-main-is documentation though.



Graham Klyne
For email:

More information about the Glasgow-haskell-users mailing list