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.


_______________________________________________
Make-w32 mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/make-w32

Reply via email to