#2979: better support for FFI C wrappers for macros in system headers
-----------------------------+----------------------------------------------
Reporter: duncan | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 6.10.1 | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
Often C functions get defined via macros on some systems. For example
iconv gets munged and renamed by some silly macros on OSX. This messes up
the iconv binding package (and haskeline which currently directly ffi
imports iconv rather than using the Haskell iconv package).
Actually making wrapper functions is harder than it should be. For one
thing one has to pick a single name for the wrapper function and this then
prevents loading multiple versions of a Haskell package because their C
symbols will clash. We have similar problems for C snippets in other
packages like bytestring, so it's not constraint to FFI wrappers.
We should think about how to make this easier. We should think about where
the best place to put improvements eg ghc, cabal, c2hs or hsc2hs.
Perhaps just a way to compile versioned C function names using a CPP
define for the current package name and version. Eg in the .c file:
{{{
int HS_VERSIONED_SYMBOL(foo_wrapper) (int blah) {
...
}
}}}
And similar in the .hs file where we ffi import it.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2979>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs