Re: [luabind] program works for 32bit but not for 64.
Brought to you by:
arvidn,
daniel_wallin
From: Stephen B. - A. E. <sbl...@ra...> - 2011-10-13 12:42:48
|
Hi Nigel, I'll look into the luaL_dostring() return today. Assuming that you are correct and no overload was found, what then? The size of size_t is 8 bytes on a 64bit system. Thanks, Steve ________________________________ From: Nigel Atkinson [mailto:ni...@at...] Sent: Wednesday, October 12, 2011 6:36 PM To: lua...@li... Subject: Re: [luabind] program works for 32bit but not for 64. It might be useful to check the return value of luaL_dostring and if it's not zero, print out the string at the top of the stack. My guess is that it will say something along the lines of no overload found. What's the size of size_t on Win64? long? long long? Nigel Atkinson On 13/10/2011, at 8:27 AM, Stephen Blackwell - Applications Engineering wrote: Below is a test-program I have been using. I'm compiling in Visual Studio 2008 on a 64 bit Windows 7 box and I have 5.1.4 of lua. Luabind seems to be 0.9.1. When I compile for a 64 bit platform and I typedef MY_TYPE to int, the program works. If I typedef it to size_t, greet never gets called When I compile for a 32 bit platform both cases work. (obviously since int and size_t are then the same size) Does anyone have any suggestions for 64bit? Thanks, Steve #include <iostream> #include <luabind/luabind.hpp> using namespace std; // int works, size_t doesn't. typedef size_t MY_TYPE; class NP { public: NP(MY_TYPE number) : m_number(number) {} MY_TYPE greet(string& s, string& t) { cout << s << m_number << t << endl; return m_number; } private: MY_TYPE m_number; }; int main() { using namespace luabind; lua_State *myLuaState = lua_open(); open(myLuaState); module(myLuaState) [ class_<NP>("NumberPrinter") .def(constructor<MY_TYPE>()) .def("greet", &NP::greet) ]; luaL_dostring(myLuaState, "Print2000 = NumberPrinter(2000)\n" "Print2000:greet(\"Hello \", \" world!\")\n" ); std::cout << "sizeof(LUA_INTEGER) = " << sizeof(LUA_INTEGER) << std::endl; std::cout << "sizeof(int) = " << sizeof(int) << std::endl; std::cout << "sizeof(long) = " << sizeof(long) << std::endl; lua_close(myLuaState); return 0; } Privileged/Confidential Information may be contained in this email. If you are not the addressee indicated in this email (or responsible for delivery of the message to such person), you may not copy or deliver this email to anyone. In such case, you should destroy this email and kindly notify the sender by phone at (386) 267-2936. Please advise immediately if you or your employer do not consent to emails of this kind. Not for release to foreign persons: controlled under U.S. Federal Regulations. Opinions, conclusions and other information in this email that do not relate to the official business of Raydon Corporation shall be understood as neither given nor endorsed by it. ------------------------------------------------------------------------ ------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct______________________________________ _________ luabind-user mailing list lua...@li... https://lists.sourceforge.net/lists/listinfo/luabind-user Privileged/Confidential Information may be contained in this email. If you are not the addressee indicated in this email (or responsible for delivery of the message to such person), you may not copy or deliver this email to anyone. In such case, you should destroy this email and kindly notify the sender by phone at (386) 267-2936. Please advise immediately if you or your employer do not consent to emails of this kind. Not for release to foreign persons: controlled under U.S. Federal Regulations. Opinions, conclusions and other information in this email that do not relate to the official business of Raydon Corporation shall be understood as neither given nor endorsed by it. |