[GHC] #13366: addCStub doesn't allow control over compiler flags or source file file

GHC ghc-devs at haskell.org
Mon Mar 6 11:50:21 UTC 2017


#13366: addCStub doesn't allow control over compiler flags or source file file
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  bitonic
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.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 bitonic):

 The situation is that right now `addCStubs` streams content to the same
 file that is used for Haskell-from-C exports and `capi` calls, which I
 think is very fragile.

 This file includes imports and CPP macros outside the control of the
 person using `addCStub`, and thus code using `addCStub` might very well
 break if we change how that file is generated of simply if the C code
 conflicts with the content that is already in the stubs file.

 Moreover, if we want to add multi-language support, we needed to generate
 multiple files anyway.

 So me, rwbarton, and bgamari concluded that it would be better to just let
 the user emit an arbitrary number of files that will be compiled and
 linked with the current module. This is well-suited to `inline-c` since we
 can collect all the stubs and emit them at once with `addModFinalizer`.

 Hopefully this makes the motivation for the change clearer.

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


More information about the ghc-tickets mailing list