[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MS compiler 7.1 (Visual Studio .NET 7.1 and DDK 2003) issues withma
From: |
Alessandro Vesely |
Subject: |
Re: MS compiler 7.1 (Visual Studio .NET 7.1 and DDK 2003) issues withmake 3.80 |
Date: |
Mon, 25 Apr 2005 12:32:55 +0200 |
Jerker Bäck wrote:
> Eli Zaretskii:
> > Why did you need to use __stdcall?
>
> At this stage: It will catch any callback into the CRT without having been
> declared __cdecl.
`callback'?! I guess you mean `call'. There is no need to specify a calling
convention to invke a C function.
> This is important since the Microsoft CRT are built with
> __cdecl calling convention while in all other cases it is built with
> __stdcall (WINAPI) calling convention.
MS provides system calls prototypes in windows headers in order to match
their ABI. However, C does not require a specific ABI: the calling
conventions came as a mean to interface programs written in different
languages (specifically basic, the main programming language on the
ancient IBM PC.)
In facts, even if it is possible -for backward compatibility- to call a
C function without a full prototype, it is insane to call system functions
that way. It is more reliable to use full prototypes anyway, but again,
it is the compiler responsibility to use a suitable calling convention.
> Some developers love to use the
> __fastcall calling convention. If these callbacks are declared as __cdecl,
> the code will be compatibel in either case.
In general, the implementor specific leading `__' jeopardizes portability.
Pushing their usage is one of the results of the marketing interferences
in technical questions, which play havoc with the culture of an otherwise
technically sound company.