Skip to content

FFI: "capi" calling convention doesn't work

According to http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/ffi.html#ffi-capi there is a capi calling convention, but ghc disagrees:

% cat capi.hs 
{-# LANGUAGE ForeignFunctionInterface #-}

import Foreign.C

foreign import capi "math.h value M_PI" mPI :: CDouble

main :: IO ()
main = print mPI

% ghc capi.hs
[1 of 1] Compiling Main             ( capi.hs, capi.o )

capi.hs:5:16: parse error on input `capi'

Is the documentation wrong?

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information