From afbc7c839d19ff9243a52082fa25c4125dcdf02a Mon Sep 17 00:00:00 2001
From: rrt
The GD has been substantially extended for GHCi, i.e., the interactive variant of GHC that integrates the compiler with a (meta-circular) interpreter since version 5.00. +
+RTS
and libHSstd
+ Since the RTS and HSstd refer to each other, there is a Cunning
+ Hack to avoid putting them each on the command-line twice or
+ thrice (aside: try asking for `plaice and chips thrice' in a
+ fish and chip shop; bet you only get two lots), namely to add
+ the symbols that the RTS needs from libHSstd, such as
+ PrelWeak_runFinalizzerBatch_closure
and
+ __init_Prelude
to the link line with the
+ -u
flag. The standard library appears before the
+ RTS on the link line (why? might it be better the other way
+ around? [SPJ]), and these options cause the corresponding
+ symbols to be picked up even if they haven't been already, so
+ that when the RTS is also scanned, they are resolved. This
+ avoids the linker having to read the standard library and RTS
+ multiple times.
+
+ This does, however, lead to a complication. Normal Haskell
+ programs do not have a main
function, so this is
+ supplied by the RTS. It calls startupHaskell
, which
+ itself calls __init_PrelMain
, which is therefore,
+ since it occurs in the standard library, one of the symbols
+ passed to the linker. However, when the main
+ function is provided by the programmer (e.g. when there is no
+ main module, but a C module instead),
+ __init_PrelMain
had better not be linked in,
+ because it tries to call __init_Main
, which won't
+ exist. This case is coped with by the -no-hs-main
+ flag, although in some versions of the compiler (e.g. 5.00.2) it
+ didn't work.
+
-Last modified: Wed Aug 8 19:22:14 EST 2001 +Last modified: Wed Aug 22 17:01:33 GMT Daylight Time 2001