[Hackage] #190: extension ForeignFunctionInterface should imply -fvia-C for ghc

Hackage trac at galois.com
Mon Dec 17 11:20:17 EST 2007

#190: extension ForeignFunctionInterface should imply -fvia-C for ghc
  Reporter:  duncan       |        Owner:         
      Type:  enhancement  |       Status:  new    
  Priority:  normal       |    Milestone:         
 Component:  Cabal        |      Version:
  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

More information about the cabal-devel mailing list