TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date:
Tue, 1 Dec 1998 11:14:36 -0500
Reply-To:
David Koogler <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
Content-Type:
text/plain; charset=us-ascii
Organization:
Boolean Solutions, Ltd.
From:
David Koogler <[log in to unmask]>
Parts/Attachments:
text/plain (30 lines)
> Can anyone point me to a description of the Stdcall
> convention so I can understand better how it differs
> from C convention? ( I have some code that doesn't
> seem to care which convention is used - but the
> code below falls over with convention C)
>
> Is there a good reason for windows libraries to not use
> C convention?
> Or is it just an accident of Microsoft history?

It is an accident of Microsoft history. Stdcall is the modern version
of the _pascal calling convention which forces the C compiler to emit calls
which conform to the old Microsoft Pascal calling convention.
Under this convention, the called program cuts back the stack not the
caller. Hence it is important to know the exact size of the passed
parameter set and leads to mangling of the called routine names to indicate
the expected size.

Microsoft uses this convention for Windows because the original
implementation of Windows was written in Pascal and they were competing
(copying?) Apple's windowing interface which was also written in
Pascal. Inertia explains why Microsoft has not dropped this convention.

For the Purists: there is a slight speed and space advantage (at least for
very old 286 and 386 class machines) in using the _pascal convention over
the C convention.

David J.A. Koogler
Boolean Solutions, Ltd.

ATOM RSS1 RSS2