pascal
Specifies a Pascal-style calling convention in a procedure declaration
Syntax
`
Declare [Static] Sub procedure_name [Overload] pascal [Alias "external_name"] [([parameter_list])] [Constructor [priority]] [Static] [Export]
Declare [Static] Function procedure_name [Overload] pascal [Alias "external_name"] [([parameter_list])] As return_type [Static] [Export]
[Public|Private] Sub procedure_name [Overload] pascal [Alias "external_name"] [([parameter_list])] [Constructor [priority]] [Static] [Export]
..procedure body..
End Sub
[Public|Private] Function procedure_name [Overload] pascal [Alias "external_name"] [([parameter_list])] As return_type [Static] [Export]
..procedure body..
End Function
`
Description
In procedure declarations, `pascal` specifies that a procedure will use the Pascal calling convention. In the Pascal calling convention, any parameters are to be passed (pushed onto the stack) in the same order in which they are listed, that is, from left to right. The procedures need not preserve the `EAX`, `ECX` or `EDX` registers, and must clean up the stack (pop any parameters) before it returns.
Pascal is the default calling convention for procedures in Microsoft QuickBASIC, and is the standard convention used in the Windows 3.1 API.
Example
`
Declare Function MyFunc pascal Alias "MyFunc" (MyParm As Integer) As Integer
`
Differences from QB

- New to FreeBASIC

See also

- cdecl, stdcall
- Declare
- Sub, Function