|
From: Laurent R. <lr...@iv...> - 2015-10-23 08:14:14
|
Thx for your answer.
Sorry for my approximation, I only work under Windows. I use Visual 2012 where size_t is defined as follow
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
In x64
sizeof(long) = 4
sizeof(long long) = 8
sizeof(size_t) = 8
In x86
sizeof(long) = 4
sizeof(long long) = 4
sizeof(size_t) = 4
Regards,
Laurent
De : John Labenski [mailto:jla...@gm...]
Envoyé : vendredi 23 octobre 2015 05:13
À : wxl...@li...
Objet : Re: [wxlua-users] wxLua x64
On Thu, Sep 3, 2015 at 8:03 AM, Laurent Renoux <lr...@iv...<mailto:lr...@iv...>> wrote:
Hi John,
At first, i would like to tell you how big is your works : thanks for all.
I use wxLua with wxWidget 3.0.2 since 1 year on x86 and x64 platforms on Windows 7 with no matter. Since I have jumped on Windows 10, wxLua crash on x64. Same dll, same code. I think, I have found the problem.
In file wxlstate.cpp In function
void* LUACALL wxluaT_getuserdatatype(lua_State* L, int stack_idx, int wxl_type)
long int o = (long int)wxlua_touserdata(L, stack_idx, false);
should be changed in
size_t o = (size_t)wxlua_touserdata(L, stack_idx, false);
on Windows platforms to avoid original pointer to be truncated in 32 bits. Why it doesn’t crash since 1 year on Win7, I really don’t know, probably I’m a lucky man and memory management has changed on Win10 !
Humm, my understanding was that both long and size_t are 4 bytes on a 32-bit architecture and 8 bytes on a 64-bit architecture, but I see now that there are claims that Visual Studio kept long at 4 bytes on x64. It seems like there is no guarantees about size_t other than that it will be unsigned in the C++ standard.
Can you please print sizeof(long) and sizeof(size_t) and let me know what compiler you use?
I should use an uintptr_t, but older Visual Studio versions don't have inttypes.h so I've changed it to 'unsigned long long' so it'll work everywhere. The change is committed to svn.
Regards,
John
|