User Tools

Site Tools


c_pascal_parameter_passing_conventions_.htm
Navigation:  Language Reference > 2 - Program Source Code Format > Prototype Attributes >====== C, PASCAL (parameter passing conventions) ====== Previous pageReturn to chapter overviewNext page

C

PASCAL

blk2blue.jpg

The C and PASCAL attributes of a PROCEDURE prototype specifies that parameters are always passed on the stack. In 32-bit programs, both C and PASCAL conventions pass the parameters to the stack from right to left. The difference is in who (callee(C) or caller(PASCAL)) is cleaning the stack on return. Also, in C/C++ there is a difference in mangling of the external name, but in Clarion, name mangling is the same for both C and PASCAL. PASCAL is also completely compatible with the Windows API calling convention for 32-bit compiled applications–it is the Windows-standard calling convention (and also disables name mangling).

These calling conventions provide compatibility with third-party libraries written in other languages (if they were not compiled with a TopSpeed compiler). If you do not specify a calling convention in the prototype, the default calling convention is the internal, register-based parameter passing convention used by all the TopSpeed compilers.

Example:

MAP

 MODULE('Party3.Obj')                            !A third-party library

Func46 PROCEDURE(*CSTRING,*REAL),REAL,C,RAW       !Pass REAL then CSTRING, address-only

Func49 PROCEDURE(*CSTRING,*REAL),REAL,PASCAL,RAW  !Pass CSTRING then REAL, address-only

 END

END

See Also:

PROCEDURE Prototypes

Prototype Parameter Lists

c_pascal_parameter_passing_conventions_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)