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 this:

a) The stdcall modifier is ignored by GHC, the compiler generates a ref to DeleteObject, not [EMAIL PROTECTED] 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 "stdcall".

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?

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to