Fix #3461: protect the use of keepCAFs with #ifdef DYNAMIC
[ghc.git] / compiler / ghci / keepCAFsForGHCi.c
1 #include "Rts.h"
2
3 // This file is only included when GhcBuildDylibs is set in mk/build.mk.
4 // It contains an __attribute__((constructor)) function (run prior to main())
5 // which sets the keepCAFs flag in the RTS, before any Haskell code is run.
6 // This is required so that GHCi can use dynamic libraries instead of HSxyz.o
7 // files.
8
9 #ifdef DYNAMIC
10 static void keepCAFsForGHCi() __attribute__((constructor));
11
12 static void keepCAFsForGHCi()
13 {
14 keepCAFs = 1;
15 }
16 #endif