link with advapi32 on windows
This commit is contained in:
parent
a9ad0cb68d
commit
e740242978
@ -191,7 +191,7 @@ endif()
|
|||||||
|
|
||||||
# extra needed libraries
|
# extra needed libraries
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND mi_libraries psapi shell32 user32 bcrypt)
|
list(APPEND mi_libraries psapi shell32 user32 advapi32)
|
||||||
else()
|
else()
|
||||||
if(NOT ${CMAKE_C_COMPILER} MATCHES "android")
|
if(NOT ${CMAKE_C_COMPILER} MATCHES "android")
|
||||||
list(APPEND mi_libraries pthread)
|
list(APPEND mi_libraries pthread)
|
||||||
|
@ -36,10 +36,10 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
solution: $(BuildType)/libmimalloc.sln
|
solution: $(BuildType)/libmimalloc.sln
|
||||||
configuration: '$(MSBuildConfiguration)'
|
configuration: '$(MSBuildConfiguration)'
|
||||||
#- script: |
|
- script: |
|
||||||
# cd $(BuildType)
|
cd $(BuildType)
|
||||||
# ctest --verbose --timeout 120
|
ctest --verbose --timeout 120
|
||||||
# displayName: CTest
|
displayName: CTest
|
||||||
#- script: $(BuildType)\$(BuildType)\mimalloc-test-stress
|
#- script: $(BuildType)\$(BuildType)\mimalloc-test-stress
|
||||||
# displayName: TestStress
|
# displayName: TestStress
|
||||||
#- upload: $(Build.SourcesDirectory)/$(BuildType)
|
#- upload: $(Build.SourcesDirectory)/$(BuildType)
|
||||||
|
@ -170,6 +170,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
|
|||||||
return (BCryptGenRandom(NULL, (PUCHAR)buf, (ULONG)buf_len, BCRYPT_USE_SYSTEM_PREFERRED_RNG) >= 0);
|
return (BCryptGenRandom(NULL, (PUCHAR)buf, (ULONG)buf_len, BCRYPT_USE_SYSTEM_PREFERRED_RNG) >= 0);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
#pragma comment (lib,"advapi32.lib")
|
||||||
#define RtlGenRandom SystemFunction036
|
#define RtlGenRandom SystemFunction036
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -181,8 +182,8 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
|
|||||||
static bool os_random_buf(void* buf, size_t buf_len) {
|
static bool os_random_buf(void* buf, size_t buf_len) {
|
||||||
mi_assert_internal(buf_len >= sizeof(uintptr_t));
|
mi_assert_internal(buf_len >= sizeof(uintptr_t));
|
||||||
memset(buf, 0, buf_len);
|
memset(buf, 0, buf_len);
|
||||||
RtlGenRandom(buf, (ULONG)buf_len);
|
bool ok = (RtlGenRandom(buf, (ULONG)buf_len) != 0);
|
||||||
return (((uintptr_t*)buf)[0] != 0); // sanity check (but RtlGenRandom should never fail)
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(ANDROID) || defined(XP_DARWIN) || defined(__APPLE__) || defined(__DragonFly__) || \
|
#elif defined(ANDROID) || defined(XP_DARWIN) || defined(__APPLE__) || defined(__DragonFly__) || \
|
||||||
|
Loading…
Reference in New Issue
Block a user