[darcs-devel] [darcs-users] Problem building darcs 2 on WinXP

Simon Marlow simonmarhaskell at gmail.com
Tue Dec 18 09:56:07 UTC 2007


David Roundy wrote:
> On Tue, Dec 18, 2007 at 09:20:22AM +1100, Rob Moss wrote:
>> On 18/12/2007, David Roundy <droundy at darcs.net> wrote:
>>> On Mon, Dec 17, 2007 at 03:55:20PM +0000, Simon Marlow wrote:
>>>> Looks like it should be
>>>>
>>>> foreign import stdcall "winbase.h SleepEx" c_SleepEx ...
>>>>
>>>> (i.e. stdcall rather than ccall)
>>>>
>>>> this would cause it to work with -fvia-C but fail with -fasm, because the C
>>>> compiler can see the prototype.  Arguably a bug in -fvia-C, but it's been
>>>> that way for a very long time.
>>> I'm not sure I understand what's gone wrong here.  Do either of you have a
>>> recommendation for something our fearless user can try? or a patch for us
>>> to apply?
>> Thanks a lot everybody! By changing the import from ccall to stdcall,
>> I was able to successfully compile darcs! The HTML manual is also
>> compiled, although there must be some small problem (maybe in the
>> makefile?) as make rebuilds the manual every time I run it. That
>> doesn't matter at all to me, but if you'd like I can try to figure out
>> what the problem might be.
>>
>> Anyway, I'm off to test darcs 2! Thanks again for your help :)
> 
> Great!
> 
> But I'm still confused as to what change (if any) I should make.  I thought
> I understood that changing to stdcall would fail on older versions of ghc,
> or is that always the correct way to go? If so, should we perhaps put in a
> configure test to determine which is the proper way to call this function?

stdcall is the correct calling convention for SleepEx, and it should work 
with all versions of GHC.  Older versions of GHC used -fvia-C by default, 
which had the effect of hiding the fact that the calling convention was 
wrong, -fasm is less forgiving.

Summary: just change it to stdcall.

Cheers,
	Simon



More information about the darcs-devel mailing list