[project @ 2005-04-22 16:01:53 by sof]
[ghc-hetmet.git] / ghc / compiler / deSugar / DsForeign.lhs
index 03f0777..b909c57 100644 (file)
@@ -530,10 +530,21 @@ mkFExportCBits c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
           Nothing -> empty
           Just hs_fn -> text "extern StgClosure " <> ppr hs_fn <> text "_closure" <> semi
 
+   -- the only reason for making the mingw32 (anything targetting PE, really) stick
+   -- out here is that the GHCi linker isn't capable of handling .ctors sections
+  useStaticConstructors 
+#if defined(mingw32_HOST_OS)
+       = False
+#else
+       = True
+#endif  
+
   initialiser
      = case maybe_target of
           Nothing -> empty
-          Just hs_fn ->
+          Just hs_fn 
+          | not useStaticConstructors -> empty
+          | otherwise ->
             vcat
              [ text "static void stginit_export_" <> ppr hs_fn
                   <> text "() __attribute__((constructor));"