Lazarus

Free Pascal => Windows => Topic started by: 440bx on August 20, 2021, 12:21:39 am

Title: C fastcall convention in FPC ?
Post by: 440bx 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.
Title: Re: C fastcall convention in FPC ?
Post by: skalogryz 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.
Title: Re: C fastcall convention in FPC ?
Post by: 440bx 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
Title: Re: C fastcall convention in FPC ?
Post by: PascalDragon 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