better support for FFI C wrappers for macros in system headers
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |