Accessing elements in foreign array of structs
"Erik Ronström (as erik dot ronstrom at doremir dot com)" <[email protected]> Sun, 12 Apr 2026 20:53:18 +0200
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am calling a foreign function that takes an array of points as input.
(fli:define-c-struct (point (:foreign-name "tagPOINT"))
(x :long)
(y :long))
(let ((points (fli:allocate-foreign-object :type 'point :nelems 3)))
(the-foreign-function points))
I can't figure out how to access the elements of the foreign array directly.
This works:
(let ((p (fli:allocate-foreign-object :type 'point)))
(setf (fli:foreign-slot-value p 'x) 100
(fli:foreign-slot-value p 'y) 200
(fli:dereference points :index 0) p)
But how do I set the elements of points without using an intermediate object?
Erik
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html