program works for 32bit but not for 64.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Nigel Atkinson-2
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Ryan Pavlik-4
Does this happen if you use my branch of luabind? https://github.com/rpavlik/luabind Among other things, I modified it to use boost typetraits to determine what the integer types are, so dodging the "incomplete list" issue that might be contributing to what you're seeing.

Ryan

On Wed, Oct 12, 2011 at 5:36 PM, Nigel Atkinson <[hidden email]> wrote:
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 <a href="tel:%28386%29%20267-2936" value="+13862672936" target="_blank">(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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user




--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

[hidden email]
http://academic.cleardefinition.com

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering
In reply to this post by Nigel Atkinson-2

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:[hidden email]]
Sent: Wednesday, October 12, 2011 6:36 PM
To: [hidden email]
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
[hidden email]
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.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering

Hi Nigel,

I added:
        cout << "Lua error = " << lua_tostring(myLuaState, -1) << endl;

after the luaL_dostring() and, as you suspected I get this:
        lua error = No matching overload found, candidates:
        custom [unsigned __int64] greet(NumberPrinter&,std::string&,std::string&)

Thanks,
Steve
________________________________________
From: Stephen Blackwell - Applications Engineering [mailto:[hidden email]]
Sent: Thursday, October 13, 2011 8:43 AM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.

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:[hidden email]]
Sent: Wednesday, October 12, 2011 6:36 PM
To: [hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering
In reply to this post by Ryan Pavlik-4
Ryan,

I tried your luabind and got the same results.

Thanks,
STeve

________________________________________
From: Ryan Pavlik [mailto:[hidden email]]
Sent: Wednesday, October 12, 2011 7:10 PM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.

Does this happen if you use my branch of luabind? https://github.com/rpavlik/luabind Among other things, I modified it to use boost typetraits to determine what the integer types are, so dodging the "incomplete list" issue that might be contributing to what you're seeing.

Ryan
On Wed, Oct 12, 2011 at 5:36 PM, Nigel Atkinson <[hidden email]> wrote:
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

David Osipyan-3
In reply to this post by Stephen Blackwell - Applications Engineering

Hi Steve,

I've the same issue/ Resolved using http://luaforge.net/projects/lnum/


Best,
David

On Thu, Oct 13, 2011 at 2:27 AM, Stephen Blackwell - Applications Engineering <[hidden email]> 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 <a href="tel:%28386%29%20267-2936" value="+13862672936" target="_blank">(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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user




--
Best regards
David Osipyan

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering
In reply to this post by Stephen Blackwell - Applications Engineering
Ah, I think I spoke too soon. Now it is working. I don't know what went wrong before. Thank you Ryan!!

Now I'm having a problem with a slightly more complicated version. The results of the file below are:

Hello 2000 world!
Lua error = No matching overload found, candidates:
void foo(NumberPrinter&,custom [float] const&)

I also tried the .def that is commented out but got the same result.
Again, this is with VS2008 in a 64bit configuration.

Thanks,
Steve
==========================================================
#include <iostream>
#include <luabind/luabind.hpp>

typedef const std::string& StringRefC;
using namespace std;

typedef size_t MY_TYPE;

////////////////////////////////////////////
class X {
public:
        virtual void foo(const float& f) = 0;
};

class NP : public X {
public:
        NP(MY_TYPE number) : m_number(number) {}

        MY_TYPE greet(StringRefC s, StringRefC t)
        {
                cout << s << m_number << t << endl;
                return m_number;
        }
        virtual void foo(const float& x) override { f = x; }
private:
        MY_TYPE m_number;
        float   f;
};

///////////////////////////////////////////////
int main()
{
        using namespace luabind;

        lua_State *myLuaState = lua_open();

        open(myLuaState);

        module(myLuaState)
        [
                class_<X>("X"),
                class_<NP,X>("NumberPrinter")
                .def(constructor<MY_TYPE>())
                .def("greet", &NP::greet)
                .def("foo", &NP::foo)
                //.def("foo", (void(NP::*)(const float&))&NP::foo)
        ];

        luaL_dostring(myLuaState,
                "Print2000 = NumberPrinter(2000)\n"
                "Print2000:greet(\"Hello \", \" world!\")\n"
                "Print2000:foo(0.1)\n"
                );
        const char* s = lua_tostring(myLuaState, -1);
        if (s)
        {
                cout << "Lua error = " << s << endl;
        }

        lua_close(myLuaState);
        return 0;
}

-----Original Message-----
From: Stephen Blackwell - Applications Engineering [mailto:[hidden email]]
Sent: Thursday, October 13, 2011 10:23 AM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.

Ryan,

I tried your luabind and got the same results.

Thanks,
STeve

________________________________________
From: Ryan Pavlik [mailto:[hidden email]]
Sent: Wednesday, October 12, 2011 7:10 PM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.

Does this happen if you use my branch of luabind? https://github.com/rpavlik/luabind Among other things, I modified it to use boost typetraits to determine what the integer types are, so dodging the "incomplete list" issue that might be contributing to what you're seeing.

Ryan
On Wed, Oct 12, 2011 at 5:36 PM, Nigel Atkinson <[hidden email]> wrote:
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
[hidden email]
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.


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

Stephen Blackwell - Applications Engineering
In reply to this post by David Osipyan-3
Hi David,

I tried to use lnum but I couldn't get it to work on Windows.
The patch is trying to patch Makefile which, of course, doesn't exist for the Windows version and then the Windows version of patch crashed when I told it to skip the Makefile.

I was able to get my test program to work using Ryan Pavlik's version of luabind (https://github.com/rpavlik/luabind) but now I'm having problems with derived classes.

I'd still be interested to hear how you used lnum.

Thanks,
Steve

________________________________________
From: David Osipyan [mailto:[hidden email]]
Sent: Thursday, October 13, 2011 2:53 PM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.


Hi Steve,

I've the same issue/ Resolved using http://luaforge.net/projects/lnum/


Best,
David
On Thu, Oct 13, 2011 at 2:27 AM, Stephen Blackwell - Applications Engineering <[hidden email]> 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

>-Program snipped-<



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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: program works for 32bit but not for 64.

David Osipyan-3

Hi Steve,

I've looked my code again and found that умут after applying lnum patch
I had to use long instead of size_t .

David.

On Fri, Oct 14, 2011 at 6:30 PM, Stephen Blackwell - Applications Engineering <[hidden email]> wrote:
Hi David,

I tried to use lnum but I couldn't get it to work on Windows.
The patch is trying to patch Makefile which, of course, doesn't exist for the Windows version and then the Windows version of patch crashed when I told it to skip the Makefile.

I was able to get my test program to work using Ryan Pavlik's version of luabind (https://github.com/rpavlik/luabind) but now I'm having problems with derived classes.

I'd still be interested to hear how you used lnum.

Thanks,
Steve

________________________________________
From: David Osipyan [mailto:[hidden email]]
Sent: Thursday, October 13, 2011 2:53 PM
To: [hidden email]
Subject: Re: [luabind] program works for 32bit but not for 64.


Hi Steve,

I've the same issue/ Resolved using http://luaforge.net/projects/lnum/


Best,
David
On Thu, Oct 13, 2011 at 2:27 AM, Stephen Blackwell - Applications Engineering <[hidden email]> 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

>-Program snipped-<



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 <a href="tel:%28386%29%20267-2936" value="+13862672936">(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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user



--
Best regards
David Osipyan

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user