Murga-Projects Forums
build problems on amd64 - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: build problems on amd64 (/showthread.php?tid=15)


build problems on amd64 - dcharno - 05-05-2007 03:40 PM

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


RE: build problems on amd64 - Tobi - 05-11-2007 04:44 PM

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


RE: build problems on amd64 - Juergen - 05-11-2007 09:29 PM

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.


RE: build problems on amd64 - dcharno - 05-12-2007 06:59 AM

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.