mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-15 09:26:21 +03:00
Add support for MSVC
Tested with MSVC 8 32 and 64 bits.
This commit is contained in:
parent
b45c57ecaf
commit
fd97b1dfc7
11 changed files with 177 additions and 15 deletions
|
|
@ -56,12 +56,19 @@ static bool malloc_initializer = NO_INITIALIZER;
|
|||
static malloc_mutex_t init_lock;
|
||||
|
||||
JEMALLOC_ATTR(constructor)
|
||||
static void
|
||||
init_init_lock()
|
||||
static void WINAPI
|
||||
_init_init_lock(void)
|
||||
{
|
||||
|
||||
malloc_mutex_init(&init_lock);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma section(".CRT$XCU", read)
|
||||
JEMALLOC_SECTION(".CRT$XCU") JEMALLOC_ATTR(used)
|
||||
static const void (WINAPI *init_init_lock)(void) = _init_init_lock;
|
||||
#endif
|
||||
|
||||
#else
|
||||
static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -93,6 +93,14 @@ _tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
return (true);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# ifdef _M_IX86
|
||||
# pragma comment(linker, "/INCLUDE:__tls_used")
|
||||
# else
|
||||
# pragma comment(linker, "/INCLUDE:_tls_used")
|
||||
# endif
|
||||
# pragma section(".CRT$XLY",long,read)
|
||||
#endif
|
||||
JEMALLOC_SECTION(".CRT$XLY") JEMALLOC_ATTR(used)
|
||||
static const BOOL (WINAPI *tls_callback)(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason, LPVOID lpvReserved) = _tls_callback;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue