Lisp HUG Maillist Archive

RE: Passing lisp vector to foreign code

Yup, finally figured that out. Also, it looks like I must also provide all
start/end keyword arguments to fli:replace-foreign-array, else only the
first byte is copied. At least, that appears to be the behavior of our app.

Got this working now. Thanks for the help, all.

dey

-----Original Message-----
From: pw@snoopy.mv.com [mailto:pw@snoopy.mv.com]
Sent: Friday, July 29, 2005 12:12 PM
To: deyoung@bloodhoundinc.com
Cc: martin@lispworks.com; lisp-hug@lispworks.com
Subject: RE: Passing lisp vector to foreign code


> Here's the revised code:
> 
> (defmethod fill-stream-buffer ((self binary-input-stream) db)
>   (with-slots ((buf buffer)
>                (len bufsiz)) self
>     (multiple-value-bind (bytes nbytes)
>         (get-bytes db)
>       (let ((buf (make-array nbytes)))
>         (fli:replace-foreign-array buf bytes)
>         (setf len nbytes)))))
> 
> I've also tried (make-array nbytes :element-type 'unsigned-byte).
> 

The array must have :element-type '(unsigned-byte 8)

Paul

This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


Updated at: 2020-12-10 08:51 UTC