Skip to content

Fastcall

Paul Squires edited this page Oct 14, 2026 · 2 revisions

Home › Procedures › __Fastcall

__Fastcall

Specifies the Fastcall calling convention in a procedure declaration

Syntax

declare Sub name __Fastcall [Overload] [Alias "alias"] ( parameters )
declare Function name __Fastcall [Overload] [Alias "alias"] ( parameters ) [ ByRef ] As return_type
Sub name [__Fastcall] [Overload] [Alias "alias"] ( parameters )
Function name [__Fastcall] [Overload] [Alias "alias"] ( parameters ) [ ByRef ] As return_type

Description

Fastcall is a calling convention for x86 targets where the first and second integer arguments are passed in the in ECX and EDX registers respectively instead of on the stack. All other arguments are passed right to left and callee cleans up the stack (like Stdcall).

Fastcall can be specified at both the declaration and the definition.
If a procedure definition has a declaration (with calling convention explicit or by default) and the definition does not explicitly specify a calling convention, then the calling convention is implied by the declaration.

Note: Default calling convention on win32 x86 inside an extern "c++" block for non-static member procedures is Thiscall.

Remarks

Differences from QB

  • New to FreeBASIC

See also

Examples

Extern "c++"

    Declare Function Example __Fastcall (param1 As Long, param2 As Byte, param3 As LongInt, param4 As String) As Integer

End Extern

Category: Procedures
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally