[Cffi-devel] Fw: Casting variables and functions
Joeish W
joeish80829 at yahoo.com
Sun Mar 30 14:18:11 UTC 2014
Thanks for getting back to me., I really appreciate it
Using coerce though I'm already casting it to a float on the lisp side...I was wondering if I can cast a 4 to a float with CFFI and have the output be a 4.0f0 like it works in C...without doing anything on the Lisp side
On Sunday, March 30, 2014 7:12 AM, Stelian Ionescu <sionescu at cddr.org> wrote:
On Sun, 2014-03-30 at 06:59 -0700, Joeish W wrote:
>> This is the way I thought you did it but I'm running this and it's not
>> working:
>>
>> (with-foreign-object (float :float)
>>
>> (setf float 6)
>> (type-of float))
>>
>> >(INTEGER 0 4611686018427387903)
>>
>> The output says it is an integer
>>
>> I tried this:
>>
>>
>> (with-foreign-object (float :float)
>>
>> (setf (mem-ref float :float) 4)
>> (type-of (mem-ref float :float)))
>
>(with-foreign-object (float :float)
> (setf (mem-ref float :float)
> (coerce 4 'single-float))
>
> (mem-ref float :float))
>
>or use the syntax 4.0s0 for a literal single-float(4.0d0 is a literal
>double in comparison).
>
>--
>Stelian Ionescu a.k.a. fe[nl]ix
>Quidquid latine dictum sit, altum videtur.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140330/e223c7ec/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140330/e223c7ec/attachment.sig>
More information about the cffi-devel
mailing list