mirror of
https://github.com/reactos/reactos.git
synced 2026-06-09 01:12:59 +08:00
[STDC++COMPAT] Add rand_s for GCC 13 and pre-NT6 builds
GCC 13 STL requires this.
This commit is contained in:
@@ -7,6 +7,11 @@ list(APPEND SOURCE
|
||||
__throw_out_of_range_fmt.cpp
|
||||
StringCchCopyNA.c)
|
||||
|
||||
if(DLL_EXPORT_VERSION LESS 0x600)
|
||||
list(APPEND SOURCE
|
||||
rand_s.c)
|
||||
endif()
|
||||
|
||||
add_library(stdc++compat ${SOURCE})
|
||||
set_target_cpp_properties(stdc++compat WITH_EXCEPTIONS)
|
||||
add_dependencies(stdc++compat xdk)
|
||||
|
||||
23
sdk/lib/gcc-compat/rand_s.c
Normal file
23
sdk/lib/gcc-compat/rand_s.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* PROJECT: GCC C++ support library
|
||||
* LICENSE: MIT (https://spdx.org/licenses/MIT)
|
||||
* PURPOSE: Workaround for missing rand_s on pre-NT6 builds
|
||||
* COPYRIGHT: Copyright 2026 Timo Kreuzer <timo.kreuzer@reactos.org>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
errno_t __cdecl rand_s(_Out_ unsigned int *RandomValue)
|
||||
{
|
||||
if (!RandomValue)
|
||||
return EINVAL;
|
||||
|
||||
*RandomValue = rand();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _M_IX86
|
||||
void* _imp__rand_s = rand_s;
|
||||
#else
|
||||
void* __imp_rand_s = rand_s;
|
||||
#endif
|
||||
Reference in New Issue
Block a user