TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Paul Edwards
date: 1996-01-11 19:56:02
subject: callconv.txt

Note - this document documents my current understanding.  Could
someone please let me know of any inaccuracies?  I have to make
some decision about how to declare assembler functions in PDPCLIB.



                    CALLING CONVENTIONS IN OS/2

C - parameters pushed from right to left.  Caller fixes up the
stack.

Pascal - parameters pushed from left to right.  Called function
fixes up the stack.  If a function with variable parameters is
used, the C calling convention is used instead.

Standard - the calling convention dictated by OS/2, and which
must be used when calling OS/2 routines.  Parameters are pushed
right to left.  Caller fixes up the stack.  Only difference to
C calling convention is to do with return of structures.

These are the only general forms used, each compiler has it's
own...

Borland
__cdecl gets the C calling convention
__pascal gets the pascal calling convention
__stdcall gets the Standard calling convention
__fastcall gets a Borland-specific calling convention

CSET
_System gets the standard calling convention
_Optlink gets a CSET-specific calling convention.  Their C
  library is all compiled with this calling convention

EMX
Uses the C calling convention only

Watcom
also has a Watcom-specific calling convention which is what is
  normally used.
_System (undocumented), __syscall and _syscall gets the standard 
  calling convention
_Cdecl (undocumented), __cdecl, _cdecl and cdecl get the C calling convention
_Pascal (undocumented), __pascal, _pascal and pascal get the pascal 
  calling convention
__stdcall gets a Windows calling convention
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.