chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] easyffi usage


From: William Xu
Subject: [Chicken-users] easyffi usage
Date: Tue, 08 Jul 2008 20:46:30 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2.50 (darwin)

Hi, 

I'm learning how to use the easyffi.egg.  With the following code: 

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

Built with `csc -X easyffi foo.scm',  when I try to run it, i got: 

,----
| Error: (sin) bad argument type - not a number: #<procedure (my_pi . g12)>
`----

What's the problem here? 

Also, the first example at http://chicken.wiki.br/easyffi#usage seems
not very good: 

  1) Both math.h and csi have defined "sin" function, one can't verify
     that he'd call "sin" from which.  

  2) It defined "#define my_pi 3.14" first, but the call "(print (sin 3.14))"
     doesn't use my_pi at all.  So i doubt the following clam that it'll
     generated this equivalent code:

       (define-foreign-variable my_pi float "my_pi")
    
-- 
William

http://williamxu.net9.org

You can fool all the people all of the time if the advertising is right
and the budget is big enough.
                -- Joseph E. Levine






reply via email to

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