[GHC] #14298: Let Template Haskell dynamically add something with which to link

GHC ghc-devs at haskell.org
Tue Oct 3 01:06:56 UTC 2017


#14298: Let Template Haskell dynamically add something with which to link
-------------------------------------+-------------------------------------
        Reporter:  harpocrates       |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by harpocrates):

 Let me reply to those two points in reverse order. :)

 > It seems like in generate this feature would need support from external
 tools (e.g. cabal) to work properly.

 I'm not sure that is the case. TH already has support for adding in C
 source files, compiling them, and linking them. This feature request is
 requesting a way to hook into ''just'' the linking part of the pipeline
 that was built in https://phabricator.haskell.org/D3280 (instead of also
 running a C compiler).

 I don't think cabal factors into the existing `qAddForeignFile`, so I
 don't see why it should factor into my proposed `qAddForeignFilePath`.

 > I'm a bit skeptical of this; what should happen when GHC is invoked in
 single-shot mode (e.g. `-c`)?

 I'd expect to see the same thing that would happen if GHC where invoked in
 single-shot mode on something involving `addForeignFile`, that is to say:
 `cannot find object file './Support.dyn_o'` where `Support` is the module
 containing the TH.

 That said, my understanding of `-c` is that it shouldn't work on any
 module that uses TH from another module.

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


More information about the ghc-tickets mailing list