scope of header files

John Meacham john at repetae.net
Wed Mar 5 21:46:50 EST 2008


On Thu, Mar 06, 2008 at 02:18:08AM +0000, Duncan Coutts wrote:
> There are rather too many of these C libs that define their public
> interfaces as macros. I had to adjust the zlib binding the other day to
> allow it to compile without -fvia-C. It now implements a couple macros
> in the Haskell code. I hope zlib don't change their macro in the next
> version.

Yeah, I ran into the exact same issue with my curses binding. the
solution was to use hsc2hs to create wrappers when needed.

something like this:

foreign import ccall "get_COLOR_PAIRS" colorPairsPtr :: Ptr CInt
#def inline int * get_COLOR_PAIRS (void) {return &COLOR_PAIRS;}

hsc2hs is needed anyway for portable C bindings so it isn't too onerous
of a requirement.

        John

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


More information about the Glasgow-haskell-users mailing list