![]() |
HashKey() in XTPMacros.h causes problems |
Post Reply
|
| Author | |
scotia
Newbie
Joined: 26 February 2013 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: HashKey() in XTPMacros.h causes problemsPosted: 02 May 2013 at 12:00am |
|
HashKey() in XTPMacros.h may override MFC's HashKey() but it generates hash value in a different way from MFC. That means you cannot pass a CMap created in a DLL linked with ToolKitPro to the other DLL not linked with ToolKitPro. I don't know why we need the HashKey() in XTPMacros.h while there is one in MFC. Please remove the HashKey() in XTPMacros.h.
In XTPMacros.h: template<> AFX_INLINE UINT AFXAPI HashKey<UINT_PTR>(UINT_PTR key) { return (DWORD)(((DWORD_PTR)key)>>4); } In MFC: AFX_INLINE UINT AFXAPI HashKey(ARG_KEY key) { // (algorithm copied from STL hash in xfunctional) ldiv_t HashVal = ldiv((long)(ARG_KEY)key, 127773); HashVal.rem = 16807 * HashVal.rem - 2836 * HashVal.quot; if (HashVal.rem < 0) HashVal.rem += 2147483647; return ((UINT)HashVal.rem); } |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |