Allow qrandom_p.h to be included by more than one .cpp in QtCore

I thought we could use C++17 inline variables, but those can't be used
across DLL boundaries:

 qrandom_p.h:75:48: error: definition of 'QBasicAtomicInteger<unsigned int> qt_randomdevice_control' is marked 'dllimport'

Change-Id: Id2983978ad544ff79911fffd1671f857587ef2fb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Thiago Macieira 2021-04-01 23:59:55 -07:00
parent 30d5e13768
commit 89a0ed1009
2 changed files with 5 additions and 3 deletions

View File

@ -92,6 +92,10 @@ enum {
FillBufferNoexcept = true
};
#if defined(QT_BUILD_INTERNAL)
QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC_INITIALIZER(0U);
#endif
struct QRandomGenerator::SystemGenerator
{
#if QT_CONFIG(getentropy)

View File

@ -71,9 +71,7 @@ enum RNGType {
MersenneTwister = 1
};
#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILD_CORE_LIB)
Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC_INITIALIZER(0U);
#elif defined(QT_BUILD_INTERNAL)
#if defined(QT_BUILD_INTERNAL)
extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control;
#else
static const struct