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 f47ecd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ namespace YY
#define YY_Thunks_Implemented
#define __DEFINE_THUNK(_MODULE, _SIZE, _RETURN_, _CONVENTION_, _FUNCTION, ...) \
_LCRT_DEFINE_IAT_SYMBOL(_FUNCTION, _SIZE); \
_YY_THUNKS_DEFINE_RUST_RAW_DYLIB_IAT_SYMBOL(_FUNCTION, _SIZE); \
EXTERN_C _RETURN_ _CONVENTION_ _FUNCTION(__VA_ARGS__)

#include "YY_Thunks_List.hpp"
Expand Down
10 changes: 10 additions & 0 deletions src/Thunks/YY_Thunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
= reinterpret_cast<void const*>(_FUNCTION)
#endif

#if defined(_M_IX86)
// 根据 https://github.com/Chuyu-Team/YY-Thunks/issues/78 修正一下rust raw-dylib引用规则
#define _YY_THUNKS_DEFINE_RUST_RAW_DYLIB_IAT_SYMBOL(_FUNCTION, _SIZE) \
__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_IAT_SYMBOL(_FUNCTION, _SIZE)
#endif

#ifdef __YY_Thunks_Unit_Test
#define __APPLY_UNIT_TEST_BOOL(_FUNCTION) bool _CRT_CONCATENATE(aways_null_try_get_, _FUNCTION) = false
#define __CHECK_UNIT_TEST_BOOL(_FUNCTION) if(_CRT_CONCATENATE(aways_null_try_get_, _FUNCTION)) return nullptr
Expand Down

0 comments on commit f47ecd7

Please sign in to comment.