Stdcall v. ccall on Windows FFI

Malcolm Wallace malcolm.wallace at
Wed Jun 22 10:11:57 CEST 2011

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.

On 22/06/2011, at 1:28, Mauricio CA <mauricio.antunes at> wrote:

> Hi,
> Haskell FFI addendum, when talking about calling conventions, says
> that[1]:
>   ccall
>       Calling convention of the standard C compiler on a system
>   stdcall
>       Calling convention of the Win32 API (matches Pascal conventions)
> I wonder: what would correspond to such "standard C compiler" in
> Windows? Is it, say, Visual Studio? And which convention does it use
> by default?  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'?
> (The reason I'm asking this is because I maintain a FFI macro package[2]
> that is supposed to be portable between OSs, and I would like to be sure
> I give a good solution to Windows portability.)
> Thanks,
> Maurício
> [1]
> [2]
> _______________________________________________
> Libraries mailing list
> Libraries at

More information about the Libraries mailing list