Recent

Author Topic: C fastcall convention in FPC ?  (Read 2284 times)

440bx

  • Hero Member
  • *****
  • Posts: 2558
C fastcall convention in FPC ?
« on: August 20, 2021, 12:21:39 am »
Hello,

I think I know the answer to the question I'm about to ask but, figured I'd ask in case I missed something.

I would like to use this API:
Code: C  [Select][+][-]
  1. PSLIST_ENTRY  FASTCALL InterlockedPushListSList(
  2.   _Inout_ PSLIST_HEADER ListHead,
  3.   _Inout_ PSLIST_ENTRY  List,
  4.   _Inout_ PSLIST_ENTRY  ListEnd,
  5.   _In_    ULONG         Count
  6. );
The problem is, it uses MS C's fastcall convention and I don't know if there is a way to tell FPC to use that convention.

That's my question: is there a way to tell FPC to use MS C's fastcall convention when calling a function ?

Thank you for your help.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2718
    • havefunsoft.com
Re: C fastcall convention in FPC ?
« Reply #1 on: August 20, 2021, 02:03:05 am »
i guess you'll need to create an asm wrapper to make the call.
but if you target 64-bit you don't need to do anything.

440bx

  • Hero Member
  • *****
  • Posts: 2558
Re: C fastcall convention in FPC ?
« Reply #2 on: August 20, 2021, 02:34:19 am »
i guess you'll need to create an asm wrapper to make the call.
but if you target 64-bit you don't need to do anything.
That's what I thought.  Thank you Skalogryz
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 3515
  • Compiler Developer
Re: C fastcall convention in FPC ?
« Reply #3 on: August 26, 2021, 03:42:44 pm »
That's my question: is there a way to tell FPC to use MS C's fastcall convention when calling a function ?

FPC does not support Microsoft's fastcall calling convention. Patches welcome.

 

TinyPortal © 2005-2018