Re: Win-GHC with GnuWin32 toolset--Mingw32 replacement
"Neil Mitchell" <[email protected]> Mon, 8 Jan 2007 16:45:03 +0000
| Newsgroups | gmane.comp.lang.haskell.cvs.all,gmane.comp.lang.haskell.cvs.ghc |
|---|---|
| Message-ID | <[email protected]> |
Hi > 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. Thanks Neil