scope of header files

John Meacham john at repetae.net
Thu Mar 6 06:11:20 EST 2008


On Thu, Mar 06, 2008 at 10:43:41AM +0000, Duncan Coutts wrote:
> > something like this:
> > 
> > foreign import ccall "get_COLOR_PAIRS" colorPairsPtr :: Ptr CInt
> > #def inline int * get_COLOR_PAIRS (void) {return &COLOR_PAIRS;}
> 
> The problem with that is that it doesn't follow the rules about scope of
> header files either. Technically the little .h file that hsc2hs
> generates for you needs to be installed and used by every client
> package.

no, because your stub functions have a well defined ABI (that was the
point of the stub functions after all), so you wouldn't need to keep the
header around in general assuming the compiler supported header-less
compilation (which ghc doesn't yet AFAIK).

I always thought c2hs should actually generate hsc files. That would
allow people to compile programs that use c2hs without having to install
c2hs on their build machines. hsc2hs is the minimal tool needed to write
portable C interfaces so needs to be installed on target systems anyway.
        
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list