
On Monday 07 March 2011 00:03:26, Andrew Pennebaker wrote:
$ ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs $ ./scriptedmain Main: The meaning of life is 42 $ ghc -o test -main-is Test.main test.hs scriptedmain.hs compilation IS NOT required
You have to recompile, I'm afraid. GHC generated the code for ScriptedMain.main as entry point 'main', then it generated the code for Test.main as entry point 'main', so there's two symbols for the entry point 'main', I don't think you can hide that from the linker. $ ghc -fforce-recomp -o test -main-is... That would of course be inconvenient if there's more than a small module to recompile, so it's a good idea to separate the 'main's from the code that really does stuff.
ld: duplicate symbol _ZCMain_main_info in scriptedmain.o and test.o collect2: ld returned 1 exit status
Cheers,
Andrew Pennebaker