From b6755e21f927d357e7d3bb99ee1717854fce9527 Mon Sep 17 00:00:00 2001 From: Orange Date: Sun, 22 Mar 2026 16:32:00 +0300 Subject: [PATCH] fix --- include/omath/rev_eng/internal_rev_object.hpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/include/omath/rev_eng/internal_rev_object.hpp b/include/omath/rev_eng/internal_rev_object.hpp index 0270870..9e1bfbb 100644 --- a/include/omath/rev_eng/internal_rev_object.hpp +++ b/include/omath/rev_eng/internal_rev_object.hpp @@ -119,16 +119,28 @@ namespace omath::rev_eng template ReturnType call_virtual_method(auto... arg_list) { - const auto vtable = *reinterpret_cast( + void* sub_this = reinterpret_cast( reinterpret_cast(this) + TableIndex * sizeof(std::uintptr_t)); - return call_method(vtable[Id], arg_list...); + const auto vtable = *reinterpret_cast(sub_this); +#ifdef _MSC_VER + using Fn = ReturnType(__thiscall*)(void*, decltype(arg_list)...); +#else + using Fn = ReturnType(*)(void*, decltype(arg_list)...); +#endif + return reinterpret_cast(vtable[Id])(sub_this, arg_list...); } template ReturnType call_virtual_method(auto... arg_list) const { - const auto vtable = *reinterpret_cast( + const void* sub_this = reinterpret_cast( reinterpret_cast(this) + TableIndex * sizeof(std::uintptr_t)); - return call_method(vtable[Id], arg_list...); + const auto vtable = *reinterpret_cast(sub_this); +#ifdef _MSC_VER + using Fn = ReturnType(__thiscall*)(const void*, decltype(arg_list)...); +#else + using Fn = ReturnType(*)(const void*, decltype(arg_list)...); +#endif + return reinterpret_cast(vtable[Id])(sub_this, arg_list...); } private: