FreeBASIC Thiscall
目次→命令文→
手続き→
__THISCALL←オリジナル・サイト
メンバー手続き宣言で
Thiscall 呼び出し規約を指定します。
構文:
記述:
Thiscall は、 x86 ターゲットの呼び出し規約で、最初の全体引数がスタックではなく
ECX レジスタに渡されます。 他のすべての引数は右から左に渡され、呼び出し先はスタックをクリーンアップします (Stdcall と同様)。
win32 x86 では、mingw+gcc は、スタックにプッシュする代わりに、
ECX レジスタによって非表示の
This パラメータを渡すクラスの非静的メンバ手続きのデフォルトの呼び出し規約として
Thiscall を使います。
非静的メンバー手続きの extern "c++" ブロック内の win32 x86 での既定の呼び出し規約は
Thiscall です。
Thiscall は、通常の手続きと静的メンバー手続きに対して明示的に指定することで、既定の呼び出し規則を上書きできます。
他の呼び出し規則 (Cdecl/Stdcall/etc) を明示的に指定することで、非静的メンバー手続きの既定の
Thiscall 呼び出し規則を上書きできます。
Thiscall は、宣言と定義の両方で指定できます。
手続き定義に宣言が (呼び出し規約が明示的またはデフォルトで)あり、その定義で呼び出し規約が明示的に指定されていない場合、呼び出し規約は宣言によって暗示されます。
例:
- extern "c++" 内および win32 / x86 上にあり、それが非静的メンバー手続きであり、他の呼び出し規則が指定されていない場合、デフォルトは __thiscall です:
Extern "c++"
Type T extends object
Declare Constructor() '' __thiscall is default
End Type
Constructor T() '' __thiscall is default
End Constructor
End Extern
- 定義が extern "c++" ブロックの外側にある場合、定義の __thiscall はオプションです (非静的メンバ手続きのデフォルトが __thiscall の場合):
Extern "c++"
Type T extends object
Declare Constructor() '' __thiscall is default
End Type
End Extern
Constructor T() '' __thiscall is implied by declaration
End Constructor
旧例:
'' __thiscall only makes sense on windows 32-bit
#if defined(__FB_WIN32__) And Not defined(__FB_64BIT__)
#define thiscall __thiscall
#else
#define thiscall
#endif
Extern "c++"
Type UDT
value As Long
'' fbc doesn't automatically add the __thiscall calling convention
'' therefore, currently needs to be explicitly given where needed
Declare Constructor thiscall ()
Declare Destructor thiscall ()
Declare Sub someproc thiscall ()
'' etc
End Type
End Extern
バージョン:
- fbc 1.10.0 〜:
- Thiscall 呼び出し規則は、extern "c++" / win32 / x86 で非静的メンバー手続きのデフォルトとして使用されます。
-Thiscall は、通常の手続きと静的メンバー手続きに対して明示的に指定して、既定の呼び出し規則を上書きすることができます。
- fbc 1.08.0 〜
QBからの違い:
参照: