I've augmented the Using-the-FFI page too. I hope I got it right.
http://haskell.org/haskellwiki/GHC/Using_the_FFI#Importing_C_functions_that_turn_out_to_be_CPP_macros
Simon
| -----Original Message-----
| From: glasgow-haskell-bugs-bounces at haskell.org [mailto:glasgow-haskell-bugs-bounces at haskell.org] On
| Behalf Of GHC
| Sent: 05 June 2008 09:47
| Cc: glasgow-haskell-bugs at haskell.org
| Subject: Re: [GHC] #2305: GHC does not care __RENAME macro
|
| #2305: GHC does not care __RENAME macro
| -----------------------------+----------------------------------------------
| Reporter: iquiw | Owner:
| Type: feature request | Status: closed
| Priority: normal | Milestone:
| Component: Compiler (FFI) | Version: 6.8.2
| Severity: normal | Resolution: invalid
| Keywords: | Difficulty: Unknown
| Testcase: | Architecture: Unknown
| Os: NetBSD |
| -----------------------------+----------------------------------------------
| Changes (by simonmar):
|
| * status: new => closed
| * difficulty: => Unknown
| * resolution: => invalid
|
| Comment:
|
| This is not a bug, as such - or rather, it's a bug in the via-C backend
| that it actually works when compiling with -fvia-C (we fixed this recently
| in HEAD). The FFI is defined to interface to the C ABI rather than the C
| API; it doesn't take account of CPP magic.
|
| To work around this you typically need to call a C wrapper via the FFI
| rather than calling the C function directly. The C wrapper lives in a .c
| file and gets compiled by the C compiler. We have lots of these scattered
| about the libraries already.
|
| --
| Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2305#comment:2>
| GHC <http://www.haskell.org/ghc/>
| The Glasgow Haskell Compiler