View Issue Details

IDProjectCategoryView StatusLast Update
0019494FPCCompilerpublic2019-07-18 21:19
ReporterBasil PeaceAssigned ToFlorian 
PrioritynormalSeverityfeatureReproducibilityN/A
Status assignedResolutionopen 
Platformi386OSwin32OS Version2.4.4
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0019494: Implement thiscall calling conventions
DescriptionIt can be useful to implement Microsoft's thiscall calling convention since some interfaces in WinAPI use it.
Now there is a possibility for using foreign units like ThiscallWrapper from
http://flocke.vssd.de/prog/code/pascal/rtflabel/
But it would be well if FP could do it itself.
Tagscompiler
Fixed in Revision
FPCOldBugId0
FPCTarget
Attached Files

Activities

Marco van de Voort

2011-06-06 12:07

manager   ~0048869

Thiscall seems to be a method not a function calling convention. So it probably related to the CPPclass linking?

Sven Barth

2011-06-06 13:43

manager   ~0048875

I don't know whether this is correct (I haven't looked at the cppclass code for quite some time), but it could be that FPC already implements "thiscall" as "cppdecl" (and it's the default calling convention for methods in a "cppclass").

Regards,
Sven

Marco van de Voort

2012-01-21 13:01

manager   ~0055913

Florian, do you happen to know if cppdecl=thiscall? If so, this can close I assume.

Jonas Maebe

2012-05-24 11:16

manager   ~0059895

It's not the same as cppdecl. ccpdecl is the same as cdecl, except that name mangling is different (unless g++ also uses thiscall on Windows, in which case the behaviour of cppdecl has to be changed for Windows).

thiscall is documented here: http://llvm.org/releases/3.1/docs/CodeGenerator.html#x86 :

***
Similar to X86_StdCall. Passes first argument in ECX, others via stack. Callee is responsible for stack cleaning. This convention is used by MSVC by default for methods in its ABI (CC ID = 70).
***

Alexander Mintek

2018-09-07 22:40

reporter   ~0110552

Gentle bump for this old request.
I have project related with ASIO sound drivers, and was struggling a lot to create kind of ugly wrapper to access thiscall methods:

function asioDriver.init(SysHandle:HWND):longbool; assembler;
            asm
            PUSH DWORD PTR SysHandle
            MOV ECX, SELF;
            MOV EAX, DWORD PTR [ECX]
            CALL DWORD PTR [EAX + baInit]
            end;

Issue History

Date Modified Username Field Change
2011-06-06 05:48 Basil Peace New Issue
2011-06-06 05:48 Basil Peace Tag Attached: compiler
2011-06-06 12:07 Marco van de Voort Note Added: 0048869
2011-06-06 12:56 Marco van de Voort FPCOldBugId => 0
2011-06-06 12:56 Marco van de Voort Category FCL => Compiler
2011-06-06 13:43 Sven Barth Note Added: 0048875
2012-01-21 13:01 Marco van de Voort Status new => assigned
2012-01-21 13:01 Marco van de Voort Assigned To => Florian Klämpfl
2012-01-21 13:01 Marco van de Voort Note Added: 0055913
2012-05-24 11:16 Jonas Maebe Note Added: 0059895
2013-02-16 20:38 Florian Assigned To Florian Klämpfl => Florian
2018-09-07 22:40 Alexander Mintek Note Added: 0110552