From: Kaelin Colclasure
Subject: Accessing foreign type array slot value (ACL 5.0)
Date: 
Message-ID: <fhYy3.114$L4.15243@newsin1.ispchannel.com>
Greetings,

Consider the following foreign type definition (Allegro CL 5.0):

(ff:def-foreign-type MQGMO
       (:struct
        (strucid (:array :char 4))
        (version :int)
        (options :int)
        (wait-interval :int)
        (signal-1 :int)
        (signal-2 :int)
        (resolved-q-name (:array :char 48))
        (match-options :int)
        (gs-status-block (:array :char 4))
        (msg-token (:array :unsigned-char 16))
        (returned-length :int)))

I've read through the documentation, but I'm stumped when it comes to
accessing the value of an array slot in the above foreign type. It
seems I can set the value of such a slot with the following:

(setf (ff:fslot-value obj 'msg-token)
   (make-array '(16) :element-type 'unsigned-byte :initial-element 0))

However, attempting to get the value back out of the structure yields
what appears to be a pointer value:

(ff:fslot-value obj 'msg-token)
=> 541039392

The documentation does mention #'ff:char*-to-string, but the msg-token
value is a 16-byte array -- not a C string. Is there a way to get such
a value back from a foreign structure slot?

-- Kaelin Colclasure