Build failure on Windows
simonmarhaskell at gmail.com
Wed Dec 20 05:06:53 EST 2006
Wolfgang Thaller wrote:
> On 17-Dec-06, at 12:12 AM, Ian Lynagh wrote:
>> Hi all,
>> Is anyone else seeing a failure with the HEAD linking the stage2 GHC on
>> Windows (XP Pro)? This is under cygwin, and I can build 6.6 fine. Anyone
>> got any idea what's going wrong?
> From looking at the code, my guess is that this is a severe case of
> Calling Convention Confusion.
> GetWindowsDirectoryW and GetSystemDirectoryW are declared as ccall, and
> I think they should be stdcall like everything else.
Well spotted, I've fixed those.
> As far as DeleteObject is concerned, Types.hs has a 'foreign import
> stdcall unsafe "windows.h &DeleteObject"'; there are two problems with
> a) The stdcall modifier is ignored by GHC, the compiler generates a ref
> to DeleteObject, not DeleteObject at 4 as it should. I think this is our
> link error.
> GHC would need to look at the imported thing's FunPtr type to determine
> the argument size, and complain if a non-function is imported as
> b) A pointer to a stdcall function (DeleteObject) is used where a
> pointer to a ccall function is expected (ForeignPtr finaliser). AFAICT,
> this is supposed to cause cause quite horrible crashes (stack
> corruption), and we should really be glad about that link error.
> So, I think those Get*DirectoyW functions need to be stdcalled, and
> DeleteObject needs a ccalled wrapper in cbits.
Yes. Esa (or Ian), any chance you could add a wrapper for DeleteObject?
More information about the Cvs-ghc