On Fri, 23 Sep 2005, Cyrus Harmon wrote:
> Forgive me if this is just a bad idea altogether, but, is it possible to take
> an arbitrary hunk of memory and trick sbcl into thinking that it is an array?
> Obviously, I don't want this region to be gc'ed or moved, but if I could
> just read/write into it, that would be nice.
Do you need a non-movable array, or do you need to refer to external
memory allocated by a third-party library?
In the latter case the alien interface should get you started, and in the
first the (unsupported) SB-INT:MAKE-STATIC-VECTOR should do what you
need.
There is no fundamental reason why it has to be unsupported: essentially
if the interface was double-checked for sanity, some tests written, and
possibly extended into MAKE-STATIC-ARRAY it could IMO be moved to SB-EXT.
Also, if your data is in non-lisp memory but laid out in a manner
compatible with SBCL you might look at MAKE-STATIC-VECTOR and
ALLOCATE-STATIC-VECTOR, and see if you can extend MAKE-ARRAY to accept eg.
a SAP as an argument to :DISPLACED-TO.
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."
|