Some improvements to library initialization code.

This commit is contained in:
LoRd_MuldeR 2019-05-10 23:20:50 +02:00
parent a71ae3394d
commit 7b01ea510b
8 changed files with 43 additions and 31 deletions

View File

@ -73,7 +73,7 @@ $(function() {
<div class="ttc" id="_hash_8h_html_aa9e34ac422f4e52061cb8908f922fe17"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#aa9e34ac422f4e52061cb8908f922fe17">MUtils::Hash::HASH_BLAKE2_512</a></div><div class="ttdeci">static const quint16 HASH_BLAKE2_512</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:42</div></div>
<div class="ttc" id="_hash_8h_html_af80dfb1569816fab7ab5ed32e6386458"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#af80dfb1569816fab7ab5ed32e6386458">MUtils::Hash::HASH_KECCAK_384</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_384</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:45</div></div>
<div class="ttc" id="namespace_m_utils_html"><div class="ttname"><a href="../../d3/da6/namespace_m_utils.html">MUtils</a></div><div class="ttdoc">Global MUtils namespace. </div><div class="ttdef"><b>Definition:</b> CPUFeatures.h:37</div></div>
<div class="ttc" id="_global_8h_html_a8e7b4857b78f9749233e5abc96534ca8"><div class="ttname"><a href="../../d5/d3b/_global_8h.html#a8e7b4857b78f9749233e5abc96534ca8">MUTILS_NO_COPY</a></div><div class="ttdeci">#define MUTILS_NO_COPY(CLASS)</div><div class="ttdoc">Disables copy constructor and assignment operator in the specified class. This macro should be used i...</div><div class="ttdef"><b>Definition:</b> Global.h:405</div></div>
<div class="ttc" id="_global_8h_html_a8e7b4857b78f9749233e5abc96534ca8"><div class="ttname"><a href="../../d5/d3b/_global_8h.html#a8e7b4857b78f9749233e5abc96534ca8">MUTILS_NO_COPY</a></div><div class="ttdeci">#define MUTILS_NO_COPY(CLASS)</div><div class="ttdoc">Disables copy constructor and assignment operator in the specified class. This macro should be used i...</div><div class="ttdef"><b>Definition:</b> Global.h:416</div></div>
<div class="ttc" id="_hash_8h_html_a330b73d6927d6cd95892712f9396f40e"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e">MUtils::Hash::create</a></div><div class="ttdeci">MUTILS_API Hash * create(const quint16 &amp;hashId, const char *const key=NULL)</div><div class="ttdoc">Create instance of a hash function. </div></div>
<div class="ttc" id="class_m_utils_1_1_hash_1_1_hash_html"><div class="ttname"><a href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html">MUtils::Hash::Hash</a></div><div class="ttdoc">This abstract class specifies the generic interface for all support hash algorithms. </div><div class="ttdef"><b>Definition:</b> Hash.h:57</div></div>
<div class="ttc" id="_hash_8h_html_ae38cda07e425eb7c745492215a48ae08"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#ae38cda07e425eb7c745492215a48ae08">MUtils::Hash::HASH_KECCAK_256</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_256</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:44</div></div>

View File

@ -249,12 +249,12 @@ MUTILS_API void&#160;</td><td class="memItemRight" valign="bottom"><b>shell_chan
<tr class="memitem:a77d68a73d43e70a6c63b100f8e8258cb"><td class="memItemLeft" align="right" valign="top"><a id="a77d68a73d43e70a6c63b100f8e8258cb"></a>
MUTILS_API QString&#160;</td><td class="memItemRight" valign="bottom"><b>get_file_path</b> (const int &amp;fd)</td></tr>
<tr class="separator:a77d68a73d43e70a6c63b100f8e8258cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42625342563665f192985e498538dca1"><td class="memItemLeft" align="right" valign="top"><a id="a42625342563665f192985e498538dca1"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>wow64fsredir_disable</b> (void *oldValue)</td></tr>
<tr class="separator:a42625342563665f192985e498538dca1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb3f90b82e5496f5c92abf66c8769869"><td class="memItemLeft" align="right" valign="top"><a id="abb3f90b82e5496f5c92abf66c8769869"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>wow64fsredir_revert</b> (void *oldValue)</td></tr>
<tr class="separator:abb3f90b82e5496f5c92abf66c8769869"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace80386117d27524e685492843ff36d7"><td class="memItemLeft" align="right" valign="top"><a id="ace80386117d27524e685492843ff36d7"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>wow64fsredir_disable</b> (uintptr_t &amp;oldValue)</td></tr>
<tr class="separator:ace80386117d27524e685492843ff36d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a210a8cb1ce11048d08bf8b359dd2459b"><td class="memItemLeft" align="right" valign="top"><a id="a210a8cb1ce11048d08bf8b359dd2459b"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>wow64fsredir_revert</b> (const uintptr_t oldValue)</td></tr>
<tr class="separator:a210a8cb1ce11048d08bf8b359dd2459b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33d06cfc9ed30f660685ab15188d23f2"><td class="memItemLeft" align="right" valign="top"><a id="a33d06cfc9ed30f660685ab15188d23f2"></a>
MUTILS_API QString&#160;</td><td class="memItemRight" valign="bottom"><b>get_envvar</b> (const QString &amp;name)</td></tr>
<tr class="separator:a33d06cfc9ed30f660685ab15188d23f2"><td class="memSeparator" colspan="2">&#160;</td></tr>

View File

@ -279,12 +279,12 @@ MUTILS_API void&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS
<tr class="memitem:a77d68a73d43e70a6c63b100f8e8258cb"><td class="memItemLeft" align="right" valign="top"><a id="a77d68a73d43e70a6c63b100f8e8258cb"></a>
MUTILS_API QString&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::get_file_path</b> (const int &amp;fd)</td></tr>
<tr class="separator:a77d68a73d43e70a6c63b100f8e8258cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42625342563665f192985e498538dca1"><td class="memItemLeft" align="right" valign="top"><a id="a42625342563665f192985e498538dca1"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::wow64fsredir_disable</b> (void *oldValue)</td></tr>
<tr class="separator:a42625342563665f192985e498538dca1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb3f90b82e5496f5c92abf66c8769869"><td class="memItemLeft" align="right" valign="top"><a id="abb3f90b82e5496f5c92abf66c8769869"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::wow64fsredir_revert</b> (void *oldValue)</td></tr>
<tr class="separator:abb3f90b82e5496f5c92abf66c8769869"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace80386117d27524e685492843ff36d7"><td class="memItemLeft" align="right" valign="top"><a id="ace80386117d27524e685492843ff36d7"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::wow64fsredir_disable</b> (uintptr_t &amp;oldValue)</td></tr>
<tr class="separator:ace80386117d27524e685492843ff36d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a210a8cb1ce11048d08bf8b359dd2459b"><td class="memItemLeft" align="right" valign="top"><a id="a210a8cb1ce11048d08bf8b359dd2459b"></a>
MUTILS_API bool&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::wow64fsredir_revert</b> (const uintptr_t oldValue)</td></tr>
<tr class="separator:a210a8cb1ce11048d08bf8b359dd2459b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33d06cfc9ed30f660685ab15188d23f2"><td class="memItemLeft" align="right" valign="top"><a id="a33d06cfc9ed30f660685ab15188d23f2"></a>
MUTILS_API QString&#160;</td><td class="memItemRight" valign="bottom"><b>MUtils::OS::get_envvar</b> (const QString &amp;name)</td></tr>
<tr class="separator:a33d06cfc9ed30f660685ab15188d23f2"><td class="memSeparator" colspan="2">&#160;</td></tr>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,6 +38,13 @@ template<typename K, typename V> class QHash;
/** \cond INTERNAL
*/
//Interface version
#define MUTILS_INTERFACE 2
//Build key
#define MUTILS_BUILD_KEY_HELPER(X,Y) X##" "##Y
#define MUTILS_BUILD_KEY MUTILS_BUILD_KEY_HELPER(__DATE__, __TIME__)
//MUtils API
#ifdef _MSC_VER
# ifdef MUTILS_DLL_EXPORT
@ -53,10 +60,6 @@ template<typename K, typename V> class QHash;
# define MUTILS_API
#endif
#define MUTILS_MAKE_STRING_HELPER(X) #X
#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
//Check Debug Flags
#if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
# define MUTILS_DEBUG (1)
@ -77,6 +80,14 @@ template<typename K, typename V> class QHash;
#endif
#endif
#define MUTILS_MAKE_STRING_HELPER(X) #X
#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
#define MUTILS_INIT_GLUE_HELPER(X,Y) X##Y
#define MUTILS_INIT_GLUE(X,Y) MUTILS_INIT_GLUE_HELPER(X,Y)
#define MUTILS_INITIALIZER MUTILS_INIT_GLUE(initialize_, MUTILS_INTERFACE)
/** \endcond INTERNAL
*/
@ -353,8 +364,8 @@ namespace MUtils
//Internal
namespace Internal
{
MUTILS_API int selfTest(const char *const buildKey, const bool debug);
static const int s_selfTest = selfTest(__DATE__ "@" __TIME__, MUTILS_DEBUG);
MUTILS_API int MUTILS_INITIALIZER(const char *const buildKey, const bool debug);
static const int s_initializedFlag = MUTILS_INITIALIZER(MUTILS_BUILD_KEY, MUTILS_DEBUG);
}
}

View File

@ -902,19 +902,20 @@ MUtils::fp_parts_t MUtils::break_fp(const double value)
}
///////////////////////////////////////////////////////////////////////////////
// SELF-TEST
// INITIALIZER
///////////////////////////////////////////////////////////////////////////////
int MUtils::Internal::selfTest(const char *const buildKey, const bool debug)
int MUtils::Internal::MUTILS_INITIALIZER(const char *const buildKey, const bool debug)
{
static const bool MY_DEBUG_FLAG = MUTILS_DEBUG;
static const char *const MY_BUILD_KEY = __DATE__ "@" __TIME__;
static const bool INTERNAL_DEBUG_FLAG = MUTILS_DEBUG;
static const char *const INTERNAL_BUILD_KEY = MUTILS_BUILD_KEY;
if(strncmp(buildKey, MY_BUILD_KEY, 13) || (MY_DEBUG_FLAG != debug))
if((debug != INTERNAL_DEBUG_FLAG) || strncmp(buildKey, INTERNAL_BUILD_KEY, 11))
{
MUtils::OS::system_message_err(L"MUtils", L"FATAL ERROR: MUtils library version mismatch detected!");
MUtils::OS::system_message_wrn(L"MUtils", L"Perform a clean(!) re-install of the application to fix the problem!");
MUtils::OS::system_message_err(L"MUtils", L"FATAL ERROR: MUtils library initialization has failed");
abort();
}
return 0;
volatile int _result = MUTILS_INTERFACE;
return _result;
}