Open sherkat69 opened 6 months ago
Can you give a short example that reproduces the error?
LONG WINAPI PExHandler(_EXCEPTION_POINTERS* ExceptionInfo)
{
}
lunaticpp::thunk<&PExHandler> m_thunk_PExHandler{ this };
i think, NOT SURE, that in previous versions of "windows_thunks" i could compile it.
ps: i also had another issue. maybe that fix has something to help with this issue.
Just remove the "WINAPI" macro and everything should work. The non-static callback function must not be __stdcall (that's what WINAPI does), but a "normal" thiscall function.
For x86-64 this problem does not exist, as there is only one calling convention used by msvc (fastcall) cf. https://en.wikipedia.org/wiki/X86_calling_conventions (vectorcall must be specified explicitly)
wont this affect the mechanism of exception handling when i pass this function to "AddVectoredExceptionHandler"? my whole goal was using a WINAPI in a class as a member function.
The synthesized static function returned by func()
will have the stdcall
(aka WINAPI
, aka CALLBACK
) calling convention. But the non-static member function must not have it.
(When you comment out the static_assert from above and run the code with WINAPI
in debug mode you get a stack corruption exception)
the function I'm trying to thunk is a WINAPI. in x64, it compiles fine but in x86 the static_assert fails:
I'm using VS2022 (v143) and c++17