Stdcall v. ccall on Windows FFI

Mauricio CA mauricio.antunes at gmail.com
Wed Jun 22 15:25:30 CEST 2011


I'm not concerned with existing Windows libraries APIs (those can be
stdcall or cdecl, I was told) , but with C code that you write yourself
and that you build with your Haskell code. For instance: GHC will compile
.c files given on its command line.  Is it safe to assume that C functions
compiled that way will have a calling convention matched by 'ccall'?

Best,
Maurício

> I'd say it depends entirely on the API that you are wrapping.
> Specifically the Win32 API on Windows uses stdcall, also OpenGL, but
> other more modern APIs use ccall. Visual studio can cope with either
> calling convention.

>> Haskell FFI addendum, when talking about calling conventions, says that
>> [...].
>>
>> Is it safe to assume that whatever is contained in a C file compiled
>> inside a Cabal package in Windows will have a calling convention
>> matched by 'ccall'?




More information about the Libraries mailing list