Skip to content

Commit 3024497

Browse files
committed
Fix __ImageBase issue and revert FLS usage
1 parent 568dacd commit 3024497

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎Include/internal/pycore_mimalloc.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
// CPython never uses mimalloc's C++ operator new APIs, so don't define a weak
1818
// std::get_new_handler() (_ZSt15get_new_handlerv) in libpython.
1919
# define MI_NO_CXX_NEW_HANDLER 1
20-
# ifdef MS_WINDOWS
21-
// Initialize from a CRT initializer and use FLS for thread cleanup instead
22-
// of TLS callbacks, which run during DLL attach before the CRT is set up.
23-
# define MI_WIN_INIT_USE_FLS 1
24-
# endif
2520
# ifdef Py_GIL_DISABLED
2621
# define MI_PRIM_THREAD_ID _Py_ThreadId
2722
# define MI_CPYTHON 1

‎Objects/mimalloc/prim/windows/prim.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,13 @@ static void NTAPI mi_win_main(PVOID module, DWORD reason, LPVOID reserved) {
854854
return ((imageNtHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL) == IMAGE_FILE_DLL);
855855
}
856856

857-
mi_decl_externc IMAGE_DOS_HEADER __ImageBase; // supplied by the linker
857+
#if defined(__cplusplus)
858+
extern "C" {
859+
#endif
860+
extern IMAGE_DOS_HEADER __ImageBase; // supplied by the linker
861+
#if defined(__cplusplus)
862+
}
863+
#endif
858864

859865
static bool mi_current_module_is_dll(void) {
860866
// HMODULE mod = NULL;

0 commit comments

Comments
 (0)