Repository : ssh://darcs.haskell.org//srv/darcs/hsc2hs

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9671202c11f7fe98e5b96d379532b6f691dc46dd

>---------------------------------------------------------------

commit 9671202c11f7fe98e5b96d379532b6f691dc46dd
Author: Ian Lynagh <[email protected]>
Date:   Fri Oct 19 16:28:59 2012 +0100

    Fix when using g++ as C compiler. Patch from elaforge. Fixes ghc #7232

>---------------------------------------------------------------

 UtilsCodegen.hs |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/UtilsCodegen.hs b/UtilsCodegen.hs
index 7673dce..8844052 100644
--- a/UtilsCodegen.hs
+++ b/UtilsCodegen.hs
@@ -60,16 +60,18 @@ withUtilsObject config outDir outBase f = do
              "",
              -- "void" should really be "FILE", but we aren't able to
              -- refer to "FILE" in template-hsc.h as we don't want to
-             -- include <stdio.h> there
+             -- include <stdio.h> there. We cast to FILE * so as to
+             -- allow compiling with g++.
              "int hsc_fputs(const char *s, void *stream) {",
-             "    return fputs(s, stream);",
+             "    return fputs(s, (FILE *)stream);",
              "}",
              "",
              -- "void" should really be "FILE", but we aren't able to
              -- refer to "FILE" in template-hsc.h as we don't want to
-             -- include <stdio.h> there
+             -- include <stdio.h> there. We explicitly cast to void *
+             -- to allow compiling with g++.
              "void *hsc_stdout(void) {",
-             "    return stdout;",
+             "    return (void *)stdout;",
              "}"
             ]
 



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to