> Hi, I'm trying to use the new GHC -main-is flag to compile
> programs from
> files with module names other than Main, but it doesn't seem
> to be working.
>
> I've tried this under Windows 2000 and Windows XP.
>
> Here's my test program:
> [[
> -- HelloWorld.hs
>
> -- module HelloWorld where
> module Main where
>
> main :: IO ()
> main = putStrLn "Hello, World"
> ]]
[snip]
> Compiling the above with -main-is HelloWorld.main
> [[
> D:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
> -iC:\Dev\Haskell\Lib\HUnit;C:\De
> v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Li
> b\Dfa -o
> HelloWorl
> d.exe -main-is HelloWorld.main HelloWorld
> Chasing modules from: HelloWorld
> Compiling Main ( HelloWorld.hs, HelloWorld.o )
> Linking ...
> C:/DEV/ghc/ghc-6.2/libHSrts.a(Main.o)(.text+0x87):Main.c: undefined
> reference to
> `__stginit_ZCMain'
> C:/DEV/ghc/ghc-6.2/libHSrts.a(Main.o)(.text+0xa1):Main.c: undefined
> reference to
> `ZCMain_main_closure'
> ]]
[snip]
> Finally, changing the source code module name to HelloWorld:
> [[
> D:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
> -iC:\Dev\Haskell\Lib\HUnit;C:\De
> v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Li
> b\Dfa -o
> HelloWorl
> d.exe -main-is HelloWorld.main HelloWorld
> Chasing modules from: HelloWorld
> Compiling HelloWorld ( HelloWorld.hs, HelloWorld.o )
> Warning: output was redirected with -o, but no output will be
> generated
> because there is no Main module.
> ]]
These two cases are in error, thanks for the report. The --make
compilation manager didn't notice that the Main module had changed to
HelloWorld, so it refused to link in the latter case, and attemnpted to
link (incorrectly) in the first case. This bug will be fixed in the
next release.
Cheers,
Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs