Function InterlockedPushListSList() is declared mingw-w64 header file
ntifs.h with fastcall calling convention and MS documentation says same:
https://learn.microsoft.com/en-us/windows/win32/sync/interlockedpushlistslist

Trying to compile simple code which uses InterlockedPushListSList()

  #include <ntifs.h>
  PSLIST_ENTRY func(PSLIST_HEADER ListHead, PSLIST_ENTRY List, PSLIST_ENTRY 
ListEnd, ULONG Count) {
    return InterlockedPushListSList(ListHead, List, ListEnd, Count);
  }

result in linking error:

  /usr/bin/i686-w64-mingw32-ld: /tmp/ccSHmgvJ.o: in function `func':
  /tmp/test20.c:2: undefined reference to `@InterlockedPushListSList@16'
  collect2: error: ld returned 1 exit status

Change the stdcall mangling for InterlockedPushListSList symbol in file
lib32/kernel32.def to fastcall mangling. This fixes linking error.

Also MS Windows SDK in its Kernel32.lib has declared the
InterlockedPushListSList import symbol as fastcall:
@InterlockedPushListSList@16.
---
 mingw-w64-crt/lib32/kernel32.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/lib32/kernel32.def b/mingw-w64-crt/lib32/kernel32.def
index fa375f74e3e4..4ddcf067b5e4 100644
--- a/mingw-w64-crt/lib32/kernel32.def
+++ b/mingw-w64-crt/lib32/kernel32.def
@@ -1553,7 +1553,7 @@ InitializeConditionVariable@4
 InitializeCriticalSectionEx@12
 InitializeProcThreadAttributeList@16
 InitializeSRWLock@4
-InterlockedPushListSList@8
+@InterlockedPushListSList@16 ; really fastcall calling convention
 IsCalendarLeapDay@20
 IsCalendarLeapMonth@16
 IsCalendarLeapYear@12
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to