
#190: extension ForeignFunctionInterface should imply -fvia-C for ghc --------------------------+------------------------------------------------- Reporter: duncan | Owner: Type: enhancement | Status: new Priority: normal | Milestone: Component: Cabal | Version: 1.2.3.0 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.8.1 | Platform: Linux --------------------------+------------------------------------------------- Comment (by guest): Note that `-fvia-C` can hide some problems, as well as exposing others, in a library. Typically you should test with both. The main problem is that `-fvia-C` sees definitions from header files, so if an identifier has been `#defined` to something else, then `-fvia-C` will see it, but `-fasm` won't. A good example is the A-vs-W functions on Windows: `OpenFile` is `#define`d to `OpenFileA` or `OpenFileW` depending on whether unicode support is enabled. The FFI declaration should use `OpenFileW` directly, so that it works with `-fasm`. Also, if you get the calling convention wrong on Windows (e.g. `ccall` instead of `stdcall`), then `-fvia-C` will hide the error, because it will see the C prototype with the correct calling convention annotation. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/190#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects