1. RC1 64-bit error
- Posted by irv Nov 08, 2010
- 1246 views
constant setname = define_c_proc(GTK,"gtk_widget_set_name",{C_POINTER,C_POINTER}) ----------------------------------- export function create(..... ----------------------------------- -- do some stuff here c_proc(setname,{handle,allocate_string("ThisName")})
This works fine in hundreds of places with 32 bit, but on 64bit AMD running Linux Ultimate, Euphoria can't see the constant declared outside the function.
The same error message results if I define it separately, as follows:
atom setname setname = define....
Error message is:
/home/irv/demos/GtkEngine.e:632 in function create() variable setname has not been assigned a value
Moving the declaration inside the function works. I've tried making it a global constant, doesn't see that either.
However, if I move the declaration to the top of the file, it becomes visible to the function. ?
2. Re: RC1 64-bit error
- Posted by mattlewis (admin) Nov 08, 2010
- 1207 views
constant setname = define_c_proc(GTK,"gtk_widget_set_name",{C_POINTER,C_POINTER}) ----------------------------------- export function create(..... ----------------------------------- -- do some stuff here c_proc(setname,{handle,allocate_string("ThisName")})
This works fine in hundreds of places with 32 bit, but on 64bit AMD running Linux Ultimate, Euphoria can't see the constant declared outside the function.
That's very strange. My main machine is 64-bit, and I haven't seen this sort of thing. Since you're running RC1, there's a new utility that's shipping with it: eudist. It's really useful for grabbing all of the code required for a program.
Could you try:
$ eudist irv.ex..or whatever the real name is. It should pull the main file and all of the includes into a subdir named eudist (you can customize that with a command line option). Then, if you could post a tarball of that (or email it to me), I'd like to take a look.
Matt
3. Re: RC1 64-bit error
- Posted by irv Nov 08, 2010
- 1231 views
Will do. The good news is, after moving the declaration (and making a couple of small changes to accomodate the diffs between GTK libraries) all of EuGTK works fine.
I did an eudist of the good and the bad, you can download the tarball here http://etcwebspace.com/users/irvm/eudist.tar.gz
4. Re: RC1 64-bit error
- Posted by mattlewis (admin) Nov 09, 2010
- 1209 views
Will do. The good news is, after moving the declaration (and making a couple of small changes to accomodate the diffs between GTK libraries) all of EuGTK works fine.
I did an eudist of the good and the bad, you can download the tarball here http://etcwebspace.com/users/irvm/eudist.tar.gz
Thanks. Yes, the problem was trying to use setname before it had been initialized. The "good" code works for me, too. Since other people may run into this situation (a similar thing happened recently in the standard library!), here's essentially what had happened:
constant foo = create() constant bar = define_c_func( lib, "bar", {}, C_POINTER ) function create() return c_func( bar, {} ) end function
This case was relatively easy to diagnose, since it was all in the same file. If two files include each other, however, it's important to move initialization to before the place where the other file is included, in order to make sure the initialization happens correctly.
Matt