[GHC] #13237: Extend TH with addModCStub

GHC ghc-devs at haskell.org
Fri Feb 10 20:55:38 UTC 2017


#13237: Extend TH with addModCStub
-------------------------------------+-------------------------------------
        Reporter:                    |                Owner:
  facundo.dominguez                  |  facundo.dominguez
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:                    |             Keywords:  inline-c
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3106
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nh2):

 Replying to [comment:15 facundo.dominguez]:
 > How does GHC know to recompile `A.hs` when `header.h` changes.

 This could be added with the approach I tried to describe in my last
 comment:

 * GHC sees `addCStub mystring`
 * Instead of passing `mystring` to e.g. `gcc` to generate an object file,
 it could pass it to `gcc -E` to generate a fully preprocessed C source
 code string `mycppdstring` that has all `#include`s expanded. We'd add the
 hash of `mycppdstring` to the `.hi` file.

 Please let me know if this makes clearer what I mean.

 That's outside of the design goals of your ticket though, so probably this
 enhancement should go into a different ticket.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13237#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list