C, PASCAL (parameter passing conventions)

Top  Previous  Next

 

C

PASCAL

 

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