summaryrefslogtreecommitdiff
path: root/ghc/compiler/ghci/keepCAFsForGHCi.c
diff options
context:
space:
mode:
authorwolfgang <unknown>2005-04-07 05:27:17 +0000
committerwolfgang <unknown>2005-04-07 05:27:17 +0000
commitd79c1cb2dc7c1ec5cd1ac4cb19d80c056ac2dd5d (patch)
treef638973e8f20fda46e162d980ff218c67eb95871 /ghc/compiler/ghci/keepCAFsForGHCi.c
parentba69efdd1d74ce728e790ea8bb682a5b41aa51fb (diff)
downloadhaskell-d79c1cb2dc7c1ec5cd1ac4cb19d80c056ac2dd5d.tar.gz
[project @ 2005-04-07 05:27:16 by wolfgang]
Set the keepCAFs flag (required for GHCi with dynamic libraries) from an __attribute__((constructor)) function linked to stage 2 ghc if GhcBuildDylibs is set in mk/build.mk. The previous hack (setting it from addDLL) didn't work, because a few CAFs from libHSbase_dyn were evaluated before the Linker was first invoked by GHCi. MERGE TO STABLE
Diffstat (limited to 'ghc/compiler/ghci/keepCAFsForGHCi.c')
-rw-r--r--ghc/compiler/ghci/keepCAFsForGHCi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ghc/compiler/ghci/keepCAFsForGHCi.c b/ghc/compiler/ghci/keepCAFsForGHCi.c
new file mode 100644
index 0000000000..0aabbedea0
--- /dev/null
+++ b/ghc/compiler/ghci/keepCAFsForGHCi.c
@@ -0,0 +1,15 @@
+#include "Rts.h"
+#include "Storage.h"
+
+// This file is only included when GhcBuildDylibs is set in mk/build.mk.
+// It contains an __attribute__((constructor)) function (run prior to main())
+// which sets the keepCAFs flag in the RTS, before any Haskell code is run.
+// This is required so that GHCi can use dynamic libraries instead of HSxyz.o
+// files.
+
+static void keepCAFsForGHCi() __attribute__((constructor));
+
+static void keepCAFsForGHCi()
+{
+ keepCAFs = 1;
+}