Skip to content

Commit

Permalink
Fea #76, 适配rust raw-dylib引用规则
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed May 9, 2024
1 parent 9439a08 commit d525e43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void const*>(_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"
Expand Down

0 comments on commit d525e43

Please sign in to comment.