chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] easyffi usage


From: Thomas Chust
Subject: Re: [Chicken-users] easyffi usage
Date: Tue, 08 Jul 2008 15:14:11 +0200
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.15) Gecko/20080621 SeaMonkey/1.1.10

William Xu wrote:

[...]
    (foreign-declare "
    double my_pi;
    ")
(foreign-parse "
    double my_pi = 3.14;
    ")
(print (sin my_pi))
[...]

Hello,

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)))

As my_pi isn't declared constant you could also modify its value using a call like

  (my_pi 3.1415)

cu,
Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]