From d525e435f10f60d04f6e93d075b92527712206ec Mon Sep 17 00:00:00 2001 From: mingkuang Date: Thu, 9 May 2024 16:26:01 +0800 Subject: [PATCH] =?UTF-8?q?Fea=20#76,=20=E9=80=82=E9=85=8Drust=20raw-dylib?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Thunks/YY_Thunks.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Thunks/YY_Thunks.cpp b/src/Thunks/YY_Thunks.cpp index 467ea66..3681ffc 100644 --- a/src/Thunks/YY_Thunks.cpp +++ b/src/Thunks/YY_Thunks.cpp @@ -552,10 +552,21 @@ namespace YY #include "ThreadRunner.h" +#if defined(_X86_) +// 根据 https://github.com/Chuyu-Team/YY-Thunks/issues/78 修正一下rust raw-dylib引用规则 +#define _YY_THUNKS_DEFINE_RUST_RAW_DYLIB_SYMBOL(_FUNCTION) \ +__pragma(warning(suppress:4483)) \ +extern "C" __declspec(selectany) void const* const __identifier(_CRT_STRINGIZE_(_imp_ ## _FUNCTION)) \ += reinterpret_cast(_FUNCTION) +#else +#define _YY_THUNKS_DEFINE_RUST_RAW_DYLIB_SYMBOL(_FUNCTION) +#endif + //导入实际的实现 #define YY_Thunks_Implemented #define __DEFINE_THUNK(_MODULE, _SIZE, _RETURN_, _CONVENTION_, _FUNCTION, ...) \ _LCRT_DEFINE_IAT_SYMBOL(_FUNCTION, _SIZE); \ + _YY_THUNKS_DEFINE_RUST_RAW_DYLIB_SYMBOL(_FUNCTION); \ EXTERN_C _RETURN_ _CONVENTION_ _FUNCTION(__VA_ARGS__) #include "YY_Thunks_List.hpp"