[[project @ 2003-10-29 19:05:55 by simonpj] simonpj**20031029190556 Add info about compiling the Main module ] { addfile ./ghc/docs/comm/the-beast/main.html hunk ./ghc/docs/comm/index.html 77 +
-fmain-is
flag. The trouble is
+that the runtime system is fixed, so what symbol should it link to?
+
+The current solution is this. Suppose the main function is Foo.run
.
+
Foo
, GHC adds an extra definition:
++ :Main.main = runIO Foo.run ++Now the RTS can invoke
:Main.main
to start the program. (This extra
+definition is inserted in TcRnDriver.checkMain.)
+init_:Main
, so when compiling the main module (Foo in this case),
+as well as generating init_Foo
as usual, GHC also generates
++ init_zcMain() { init_Foo; } ++This extra initialisation code is generated in CodeGen.mkModuleInit. +