News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
build problems on amd64
Author Message
dcharno
Junior Member
**


Posts: 10
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
build problems on amd64

I'm trying to build murgalua on an amd64, but the following cast

lua_getref(S, (int) udata);

fails to compile

bind-fltk.cxx: In function ‘int lua_call1_fl_ask(lua_State*)’:
bind-fltk.cxx:8940: warning: ‘fl_ask’ is deprecated (declared at /usr/include/FL/fl_ask.H:59)
bind-fltk.cxx:8940: warning: ‘fl_ask’ is deprecated (declared at /usr/include/FL/fl_ask.H:59)
bind-fltk-ext.cxx: In function ‘void lua_fltk_widget_callback(Fl_Widget*, void*)’:
bind-fltk-ext.cxx:37: error: cast from ‘void*’ to ‘int’ loses precision
make[2]: *** [bind-fltk-ext.o] Error 1

05-05-2007 03:40 PM
Find all posts by this user Quote this message in a reply
Tobi
Junior Member
**


Posts: 20
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #2
RE: build problems on amd64

Hi, maybe your compiler is set too pedantic.
Try setting the -fms-extensions and -fpermissive compiler flags
Are you using GCC via MingW ?

05-11-2007 04:44 PM
Find all posts by this user Quote this message in a reply
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #3
RE: build problems on amd64

Tobi Wrote:
Hi, maybe your compiler is set too pedantic.
Try setting the -fms-extensions and -fpermissive compiler flags
Are you using GCC via MingW ?


Or maybe the compiler is right (At least with the error message).

If I remember correctly (I have currently no such machine at hand), the size of int is 32 bit on amd64 (with gcc) and the size of void* is of course 64bit. Therefore the cast is wrong. It looks like the code is not 64 bit clean (at least not on AMD64 with gcc), because it makes some assumptions that are not always true.

05-11-2007 09:29 PM
Find all posts by this user Quote this message in a reply
dcharno
Junior Member
**


Posts: 10
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #4
RE: build problems on amd64

Juergen Wrote:
If I remember correctly (I have currently no such machine at hand), the size of int is 32 bit on amd64 (with gcc) and the size of void* is of course 64bit. Therefore the cast is wrong. It looks like the code is not 64 bit clean (at least not on AMD64 with gcc), because it makes some assumptions that are not always true.


Yes, this is exactly what is happening -- trying to store a 64-bit pointer in a 32-bit int. I was thinking about creating a C++ container to map a unique integer to the udata pointer.

05-12-2007 06:59 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: