在 2025-9-24 03:53, Pali Rohár 写道:
32-bit x86 kernel32.dll provides 6 Interlocked functions: InterlockedDecrement@4 InterlockedExchange@8 InterlockedIncrement@4 InterlockedCompareExchange@12 InterlockedExchangeAdd@8 InterlockedCompareExchange64@20WinSDK provides functions for these symbol in kernel32.lib import library as direct reference of import symbols. These 6 stdcall functions are currently missing in the 32-bit x86 mingw-w64 libkernel32.a library. mingw-w64 libkernel32.a library provides functions with same functionality but prefixed by underscore and with cdec calling convention. They are implemened as wrappers around gcc __sync_ builtin functions. So provide missing stdcall functions in 32-bit x86 libkernel32.a library via intrin.h and update corresponding comments in lib32/kernel32.def.
Using MSVC to compile for x86-32, `InterlockedExchange` is defined as a macro to `_InterlockedExchange`; the former is not declared, only the latter is, but with `__cdecl` calling convention (because it's an intrinsic?). Hence, not only is it not callable in a normal setup, it also causes an error if someone declares `LONG __stdcall InterlockedExchange(volatile LONG*, LONG);` themself, due to inconsistency about the calling convention.
In addition, is there a reason to re-implement them, instead of removing `DATA` from the DEF? -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
