chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] return a float from foreign function


From: John Cowan
Subject: Re: [Chicken-users] return a float from foreign function
Date: Mon, 28 Aug 2006 13:23:31 -0400
User-agent: Mutt/1.3.28i

Zbigniew scripsit:

> To fix in your case, add the following to the top of callit.scm.
> 
> #> float baz(int); <#
> 
> Under normal use, of course, you would use
> #> #include <impl.h> #<

Well, you're right, but I still get the same wrong result: 42.0

> Or use foreign-lambda* and include the code inline.

Now that works:

(define baz (foreign-lambda* float ((int i)) "C_return(((double)i) / 15.2);"))
(print baz)
(print (baz 42))

-- 
"The serene chaos that is Courage, and the phenomenon   address@hidden
of Unopened Consciousness have been known to the        John Cowan
Great World eons longer than Extaboulism."
"Why is that?" the woman inquired.
"Because I just made that word up", the Master said wisely.
        --Kehlog Albran, The Profit             http://www.ccil.org/~cowan




reply via email to

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