TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Jonathan de Boyne Pollard
date: 1996-01-27 02:13:12
subject: callconv.txt

PE>
  > 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.
PE>

  It's an important difference.  SYSTEM calling convention allows
  functions returning structures to be called from multiple threads at
  once, whereas CDECL calling convention would share one invisible
  structure instance amongst all threads, with the concomitant risk of
  data corruption.

  Incidentally, I usually refer to the latter as CDECL rather that C
  calling convention.  Many (incompetent) programmers confuse linkage
  specifiers (`extern "C"') with calling convention.

PE>
  > EMX
  > Uses the C calling convention only
PE>

  Then how can one call the system API ?

  I don't think that you are right.  *ALL* compilers support the SYSTEM
  calling convention.

  MetaWare High C++ uses the SYSTEM calling convention throughout, but
  does provide the _CC() calling convention specifier, which allows the
  calling convention of a function to be adjusted in various ways (such
  as controlling stack cleanup, use of registers, and the order in which
  parameters and pushed).

  > JdeBP <
___
 X MegaMail 2.10 #0:
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 712/515 711/808 809 934

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™.