Improve printing of TyThings; fixes Trac #4087
[ghc-hetmet.git] / compiler / main / CodeOutput.lhs
index d362fb4..83f23cf 100644 (file)
@@ -27,6 +27,7 @@ import Util
 import Cmm             ( RawCmm )
 import HscTypes
 import DynFlags
+import Config
 
 import ErrUtils                ( dumpIfSet_dyn, showPass, ghcExit )
 import Outputable
@@ -127,7 +128,7 @@ outputC dflags filenm flat_absC packages
                       _          -> "#include \""++h_file++"\""
 
        pkg_configs <- getPreloadPackagesAnd dflags packages
-       let pkg_names = map (display.package) pkg_configs
+       let pkg_names = map (display.sourcePackageId) pkg_configs
 
        doOutput filenm $ \ h -> do
          hPutStr h ("/* GHC_PACKAGES " ++ unwords pkg_names ++ "\n*/\n")
@@ -225,6 +226,10 @@ outputForeignStubs dflags mod location stubs
               concatMap mk_include (includes rts_pkg)
            mk_include i = "#include \"" ++ i ++ "\"\n"
 
+            -- wrapper code mentions the ffi_arg type, which comes from ffi.h
+            ffi_includes | cLibFFI   = "#include \"ffi.h\"\n"
+                         | otherwise = ""
+
        stub_h_file_exists
            <- outputForeignStubs_help stub_h stub_h_output_w
                ("#include \"HsFFI.h\"\n" ++ cplusplus_hdr) cplusplus_ftr
@@ -237,6 +242,7 @@ outputForeignStubs dflags mod location stubs
                ("#define IN_STG_CODE 0\n" ++ 
                 "#include \"Rts.h\"\n" ++
                 rts_includes ++
+                ffi_includes ++
                 cplusplus_hdr)
                 cplusplus_ftr
           -- We're adding the default hc_header to the stub file, but this