[Haskell] Using -main-is with GHC 6.4/Windows
Graham Klyne
gk at ninebynine.org
Thu Mar 17 10:56:52 EST 2005
I've been trying to use the -main-is option with GHC 6.4 on Windows. In
isolation it works fine, but it still doesn't achieve what I hoped it would.
Consider this compilation output frgament:
[[
Compiling AffyDataCalcTest ( AffyDataCalcTest.hs, AffyDataCalcTest.o )
Linking ...
./AffyDataCalc.o(.data+0xa70):fake: multiple definition of `ZCMain_main_srt'
AffyDataCalcTest.o(.data+0x1fc):fake: first defined here
./AffyDataCalc.o(.data+0xa78):fake: multiple definition of
`ZCMain_main_closure'
AffyDataCalcTest.o(.data+0x204):fake: first defined here
./AffyDataCalc.o(.text+0x9158):fake: multiple definition of `ZCMain_main_info'
AffyDataCalcTest.o(.text+0x1ff0):fake: first defined here
./AffyDataCalc.o(.text+0x9408):fake: multiple definition of `__stginit_ZCMain'
AffyDataCalcTest.o(.text+0x20c0):fake: first defined here
]]
The module 'AffyDataCalc' contains a function called 'main', which is the
topo-level function of the target program I have under development. The
module AffyDataCalcTest also has top-level function called runtest, which,
you guessed it, runs a test of the program functions. It seems that the
top-level functions still interfere with each other.
[later]
OK, it's not so bad. If I delete the AffyDataCalc.o file before compiling
AffyDataCalcTest, it all works fine.
[[
E:\OxfordCVS\DTGED\AffyData>ghc --make -fglasgow-exts -iD:\Cvs\DEV\HaskellUti
C:\Dev\Haskell\Lib\HUnit;C:\Dev\Haskell\Lib\Parsec;C:\Dev\Haskell\MyLibs\ -o
yDataCalcTest.exe -main-is AffyDataCalcTest.runtest AffyDataCalcTest
Chasing modules from: AffyDataCalcTest
Compiling ParseCSV ( ./ParseCSV.hs, ./ParseCSV.o )
Compiling FormatCSV ( ./FormatCSV.hs, ./FormatCSV.o )
Skipping ListHelpers ( D:\Cvs\DEV\HaskellUtils/ListHelpers.hs, D:\Cvs\D
HaskellUtils/ListHelpers.o )
Compiling AffyDataCalc ( ./AffyDataCalc.hs, ./AffyDataCalc.o )
Skipping HUnitLang ( C:\Dev\Haskell\Lib\HUnit/HUnitLang.lhs, C:\Dev\H
ell\Lib\HUnit/HUnitLang.o )
Skipping HUnitBase ( C:\Dev\Haskell\Lib\HUnit/HUnitBase.lhs, C:\Dev\H
ell\Lib\HUnit/HUnitBase.o )
Skipping HUnitText ( C:\Dev\Haskell\Lib\HUnit/HUnitText.lhs, C:\Dev\H
ell\Lib\HUnit/HUnitText.o )
Skipping HUnit ( C:\Dev\Haskell\Lib\HUnit/HUnit.lhs, C:\Dev\Haske
Lib\HUnit/HUnit.o )
Skipping TestHelpers ( D:\Cvs\DEV\HaskellUtils/TestHelpers.hs, D:\Cvs\D
HaskellUtils/TestHelpers.o )
Compiling AffyDataCalcTest ( AffyDataCalcTest.hs, AffyDataCalcTest.o )
Linking ...
E:\OxfordCVS\DTGED\AffyData>affydatacalctest
Cases: 2 Tried: 0 Errors: 0 Failures: 0AffyDataCalc done.
Cases: 2 Tried: 1 Errors: 0 Failures: 0AffyDataCalc done.
Cases: 2 Tried: 2 Errors: 0 Failures: 0
E:\OxfordCVS\DTGED\AffyData>ghcc AffyDataCalc
]]
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.
#g
------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
More information about the Haskell
mailing list