scope of header files
simonmarhaskell at gmail.com
Tue Mar 11 17:47:37 EDT 2008
John Meacham wrote:
> On Thu, Mar 06, 2008 at 12:23:35AM +0000, Duncan Coutts wrote:
>> Which is really annoying :-) I'd like greater control over it, in
>> particular a way to limit headers to package scope so that dependent
>> code does not need the headers.
> Ideally there would be no need for headers at all. Everything needed is
> inherently in the foreign declaration. If anything, the headers should
> just be used as a sanity check, not actually to affect the generated
> code. It would be nice if ghc just stopped relying on them and ignored
> them altogether.
Yeah, I'd like -fvia-C to be headerless. We talked about it a while
back (on the haskell-prime list I think). The main issue is that GHC
would have to generate prototypes based on the FFI declaration, and
since it can't guarantee to generate a prototype that is exactly the
same as the C prototype given in the header file (e.g. it doesn't know
about const), we would have to ensure that there really are no other
prototypes in scope, to prevent errors from the C compiler.
One reason I want to do this is that it would make via-C compilation
less fragile, particularly in terms of getting the .cabal file right.
Via-C compilation is about to get a lot less common - in 6.10 it'll only
be used for bootstrapping, so we don't want a significant fraction of
libraries fail to work when bootstrapped via C due to missing
More information about the Glasgow-haskell-users