ccall is the usual way. It works by directly linking to a character defined in a library (usually written in C).
capi is a ghc extension that runs at source level C. That's why it can access things that don't exist at the ABI level, like macros. (I don't know how this is implemented, but I would suggest that it generates a small shell of the C function, which it then compiles with the C compiler behind the scenes.)
I would use ccall where possible. It is part of the locale and looks less βmagicalβ overall.
source share