[Chicken-users] Re: Easyffi
bill RamsayW1 at comcast.net writes: Hi again, I'm still trying to get back into run m ode with Xubuntu and now I'm finding a problem with easyffi. I use gtk+ in my user interface and access it through easyffi.This is an old program that's worked for a long time - including in Chicken-4.0.0 on Gentoo. It compiles fine, but now I get the following runtime error: Error: unbound variable: foreign-parse Call history: foreign-parse-- The offending lines are only in the c code - I don't use 'foreign-parse' anywhere in the scheme code. Any ideas on what could be wrong? I rather like the Xubuntu distribution and would hate to go back to Gentoo. Hi, Bill! Are you using #? in your code? Are you using the module system? And if yes, are you doing the #? inside a module declaration that imports easyffi? Can you try to replace the #? ... # with (foreign-parse #EOF ... EOF ) cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] RE: Easyffi
Hi again, I don't believe the problem has anythning to do with Easyffi. I think the GTK+ development libraies are messed up somehow in Xubuntu.I can't get GTK to work in C either - I get a seg fault trying to open a simple top level window! I'm using the gtk+-2.0 package for the lib reference, but it doesn't work. Seaching the web seems to indicate that others are having a similar problem, but I haven't found a good account of how you set up GTK development in Xumbuntu.This is rediuculous since the whole system is based on Gnome/Gtk! Ah, the pleasures of programming. Bill ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: easyffi usage
Thomas Chust [EMAIL PROTECTED] writes: if I'm not mistaken, easyffi generates parameter style procedures to acces global C variables, probably because it is impossible in CHICKEN to create magic Scheme variables that map directly to C variables. Therefore the correct way to use my_pi in your example would be (print (sin (my_pi))) Hm, this seems hiding the error. Now, my_pi is 0.0, ... (use format-modular) (display (format (my_pi) = ~A, (sin (my_pi)) = ~A\n (my_pi) (sin (my_pi = (my_pi) = 0.0, (sin (my_pi)) = 0.0 -- William http://williamxu.net9.org ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Re: easyffi usage
William Xu wrote: [...] Hm, this seems hiding the error. Now, my_pi is 0.0, [...] Hello, well, of course my_pi is zero in your code, because you never set its value to anything else than its default initializer, which is zero in almost any sensible C compiler. You write (foreign-declare double my_pi; ) (foreign-parse double my_pi = 3.14; ) which means Include 'double my_pi;' verbatim in the C code, parse 'double my_pi = 3.14' as a C declaration and generate Scheme bindings for it. The parser of easyffi discards the initializer, because it is none of its business to deal with it. That would be the job of the C compiler, but the C compiler never gets to see the constant 3.14. You should either write (foreign-parse double my_pi; ) (foreign-declare double my_pi = 3.14; ) or simply (foreign-parse/declare double my_pi = 3.14; ) to achieve the desired effect. cu, Thomas ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: easyffi usage
Thomas Chust [EMAIL PROTECTED] writes: which means Include 'double my_pi;' verbatim in the C code, parse 'double my_pi = 3.14' as a C declaration and generate Scheme bindings for it. The parser of easyffi discards the initializer, because it is none of its business to deal with it. That would be the job of the C compiler, but the C compiler never gets to see the constant 3.14. That clarifies my question. Thanks a lot! -- William http://williamxu.net9.org There are many people today who literally do not have a close personal friend. They may know something that we don't. They are probably avoiding a great deal of pain. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users