|
From: John L. <jla...@gm...> - 2015-10-23 03:12:52
|
On Thu, Sep 3, 2015 at 8:03 AM, Laurent Renoux <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
|