Win-GHC with GnuWin32 toolset--Mingw32 replacement
ndmitchell at gmail.com
Mon Jan 8 11:45:03 EST 2007
> To my knowledge a mismatch in calling convention ( __cdecl ->
> __stdcall) is not a problem for static libraries but for dynamic
> bindings it can lead to very bad things since the stack cleanup
> methods (caller, callee) are almost completely the opposite. Since
> the Windows API's (DLL versions) are __stdcall, NativeGen will need
> to support __stdcall for dynamic bindings to them.
A mismatch is always an issue, and will always leak something
somewhere. In some cases it doesn't kill the app, but just silently
leaks for a bit. You can do dynamic bindings between all types, but
you must declare the calling convention correctly.
As the Win32 API is primarily stddecl you will of course need to
support calling stddecl functions with the FFI - but you probably want
to support all calling conventions. VS has a flag to specify the
default calling convention.
More information about the Cvs-ghc