Uses correct calling convention for virtual methods

Adjusts the virtual method calling convention based on the compiler (_MSC_VER).
This ensures compatibility and correct behavior on different platforms.
This commit is contained in:
2025-10-09 20:08:04 +03:00
parent 547f64e4c4
commit 6c5152297a

View File

@@ -26,7 +26,11 @@ namespace omath::rev_eng
template<std::size_t id, class ReturnType>
ReturnType call_virtual_method(auto... arg_list)
{
#ifdef _MSC_VER
using VirtualMethodType = ReturnType(__thiscall*)(void*, decltype(arg_list)...);
#else
using VirtualMethodType = ReturnType(__fastcall*)(void*, decltype(arg_list)...);
#endif
return (*reinterpret_cast<VirtualMethodType**>(this))[id](this, arg_list...);
}
};