Hi, even if this is not directly wxLua related: i can give a confirmation for that "long/size_t" problem on 64bit windows8+ and that today this thread gave me the correct kick in the right direction for another project. Thank you very much!
Since some days i had a problem getting a lua/ffi 64bit project running on windows8. It seems that some ASLR magic is done since windows8 which causes some problems. I tried "unsigned long long" before but it didn't work here. I am not sure if there was another problem too, i have to check that again. Bye Björn On 23.10.2015 09:56, Laurent Renoux wrote: > 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 > > typedefunsigned__int64size_t; > > #else > > typedef_W64 unsignedintsize_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:jlaben...@gmail.com] > *Envoyé :* vendredi 23 octobre 2015 05:13 > *À :* wxlua-users@lists.sourceforge.net > *Objet :* Re: [wxlua-users] wxLua x64 > > On Thu, Sep 3, 2015 at 8:03 AM, Laurent Renoux <lren...@ivory-tower.fr > <mailto:lren...@ivory-tower.fr>> 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, intstack_idx, > intwxl_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 > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > wxlua-users mailing list > wxlua-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wxlua-users > ------------------------------------------------------------------------------ _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users