Hi,
I have a question about passing values to foreign functions that are not :int.
If I define a foreign function as (cffi:defcfun "foo" :void (val :double))
I am not able to call it with (foo 45.0)
Because 45.0 is not of type :double. I have tried different ways (convert-to-foreign and so on) but I cannot solve it.
Any help is greatly appriciated. // Nik
(foo 45.0d0)
This has nothing to do with "non-:int" or even foreign functions, it has to with how you create a double float in lisp.
Liam
On Wed, Jun 30, 2010 at 5:16 PM, N J raphexion@gmail.com wrote:
Hi,
I have a question about passing values to foreign functions that are not :int.
If I define a foreign function as (cffi:defcfun "foo" :void (val :double))
I am not able to call it with (foo 45.0)
Because 45.0 is not of type :double. I have tried different ways (convert-to-foreign and so on) but I cannot solve it.
Any help is greatly appriciated. // Nik
cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
On Wed, Jun 30, 2010 at 10:16 PM, N J raphexion@gmail.com wrote:
Because 45.0 is not of type :double
Indeed, (type-of 45.0) => SINGLE-FLOAT. Try passing 45.0d0.
Cheers,
On Wed, Jun 30, 2010 at 11:46 PM, Luís Oliveira luismbo@gmail.com wrote:
On Wed, Jun 30, 2010 at 10:16 PM, N J raphexion@gmail.com wrote:
Because 45.0 is not of type :double
Indeed, (type-of 45.0) => SINGLE-FLOAT. Try passing 45.0d0.
Cheers,
Ah, thanks a lot. That works great. I think I need to sit down and read up on the type system in lisp :) I am not used to it at all.
Once again thanks for the help /Nik
-- Luís Oliveira http://r42.eu/~luis/