Double trouble
- Posted by irv May 29, 2012
- 1728 views
I have a new version of EuGtk which runs on both 32 and 64-bit processors (at least the ones that I own), using Euphoria 4.1.0. Download EuGTK4.6.0: https://sites.google.com/site/euphoriagtk/
There remains one problem. A few GTK routines require 6 or 7 doubles to be passed to them. The 32-bit version of Eu 4.1 handles this just fine, but the 64-bit goes astray. Here's a test to show what happens:
// dbl.c #include <stdio.h> void display_double(double d1, double d2, double d3, double d4, double d5, double d6) { printf("One %g\n",d1); printf("Two %g\n",d2); printf("Three %g\n",d3); printf("Four %g\n",d4); printf("Five %g\n",d5); printf("Six %g\n",d6); }
--dbl.ex include std/machine.e include std/dll.e atom lib = open_dll("./dbl.so") atom fn = define_c_proc(lib,"displaydouble",{C_DOUBLE,C_DOUBLE,C_DOUBLE,C_DOUBLE,C_DOUBLE,C_DOUBLE}) c_proc(fn,{1.1,1.2,1.3,1.4,1.5,1.6})
Eu 4.1.0 in 64-bit version prints a bogus value for Six. Fortunately, this problem only affects a couple of Cairo graphic routines.