program works for 32bit but not for 64.

"Stephen Blackwell - Applications Engineering" <[email protected]> Wed, 12 Oct 2011 17:27:03 -0400
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user