Repository navigation
Thiscall
Home › Procedures › __Thiscall
Specifies the Thiscall calling convention in a procedure declaration
declare Sub name __Thiscall [Overload] [Alias "alias"] ( parameters )
declare Function name __Thiscall [Overload] [Alias "alias"] ( parameters ) [ ByRef ] As return_type
Sub name [__Thiscall] [Overload] [Alias "alias"] ( parameters )
Function name [__Thiscall] [Overload] [Alias "alias"] ( parameters ) [ ByRef ] As return_typeThiscall is a calling convention for x86 targets where the first integral argument is passed in the ECX register instead of on the stack. All other arguments are passed right to left and callee cleans up the stack (like Stdcall).
On win32 x86, mingw+gcc will use Thiscall as the default calling convention for non-static member procedures in classes passing the hidden This parameter by ECX register instead of pushing to the stack.
Default calling convention on win32 x86 inside an extern "c++" block for non-static member procedures is Thiscall.
Thiscall can be explicitly specified for normal procedures and static member procedures to override the default calling convention.
Other calling conventions (Cdecl/Stdcall/etc) can be explicitly specified to override the default Thiscall calling convention on non-static member procedures.
Thiscall 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.
- New to FreeBASIC
- If inside extern "c++" and also on win32 / x86, and it's a non-static member procedure, and no other calling convention is given, the default is __thiscall:
Extern "c++"
Type T Extends Object
Declare Constructor() '' __thiscall is default
End Type
Constructor T() '' __thiscall is default
End Constructor
End Extern- If definition is outside the extern "c++" block, then __thiscall is optional on the definition (if the default for the non-static member procedure was __thiscall):
Extern "c++"
Type T Extends Object
Declare Constructor() '' __thiscall is default
End Type
End Extern
Constructor T() '' __thiscall is implied by declaration
End ConstructorCategory: 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.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing